처음으로 list.phtml에서 productcollection을로드 할 때 (또는 내가 완전히 캐싱을 할 때) 반환되는 제품은 마지막으로 생성 된 카테고리에있는 제품입니다 (즉 가장 높은 ID를 가진 카테고리). 캐시가 켜지면 페이지 새로 고침시 올바른 제품이 표시됩니다. 캐시를 삭제 한 후에도 동일한 상황이 발생합니다 (올바른 제품의 경우 제품 목록이 표시 될 때 페이지를 한 번 새로 고침해야 함).Magento가 카테고리보기에서 잘못된 제품을 표시합니다.
1 개의 여분의 이상한 것; 내가
$_product->getCategory()->getName()
를 호출 할 경우 올바른 범주가 반환되지만
$_product->getName()
가 호출 될 때, 잘못된 PRODUCTNAME 반환 ... 임 완전한 손실 여기. 캐시가 켜져있을 때이 문제는 사라지지만 처음 페이지를 새로 고친 후에 만 매우 바람직하지 않은 비슷한 게시물을 읽었습니다. 다시 색인 페이지
<?php $_coreHelper = $this->helper('core'); ?>
<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php echo Mage::getModel('catalog/layer')->getCurrentCategory()->getName(); ?>
<?php echo Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); ?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="category-products">
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = 4; ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php echo var_dump($_product->getCategory()->getName()); ?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="products-grid" style="padding-left:0px;">
<?php endif ?>
<li style="height:230px;" class="hreview-aggregate hproduct item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
<h2 class="item fn product-name">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_product->getName() ?>"><?php echo substr($this->htmlEscape($_product->getName()), 0, 22).'...' ?></a>
</h2>
<div>
<div>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->getImageLabel($_product, 'small_image') ?>" class="url product-image"><img class="photo fn" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(100); ?>" width="100" height="100" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" /></a>
</div>
<div style="clear:both"></div>
</div>
<div>
<div>
<div>
<div>
<div><span style="font-size:13px;font-weight:bold;"><?php echo $_coreHelper->currency($newprice,true,false) ?> <?php echo $this->helper('tax')->__('Ex. BTW') ?></span></div><br />
<div><?php echo $_coreHelper->currency($newtaxprice,true,false) ?> <?php echo $this->helper('tax')->__('Inc. BTW') ?></div>
</div>
</div>
<div style="clear:both;"></div>
<br />
<form action="<?=$this->getAddToCartUrl($_product);?>" method="post" id="product_addtocart_form_<?=$_product->getId();?>" <?if($_product->getOptions()){?> enctype="multipart/form-data"<?}?>>
<?if(!$_product->isGrouped()){?>
<input type="text" name="qty" id="qty" maxlength="12" value="<?echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1);?>" style="width:30px;" /> x
<?}?>
<button type="button" class="button-order" onclick="this.form.submit()"><span><span><?=$this->__('Bestellen');?></span></span></button>
<br /><br />
<span><a href="" style="color:#888;">Zet in verlanglijst</a></span>
</form>
</div>
</div>
<div style="clear:both"></div>
</li>
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
</ul>
<?php endif ?>
<?php endforeach ?>
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
<?php endif; ?>
<div class="toolbar-bottom">
<?php echo $this->getToolbarHtml() ?>
</div>
</div>
은 맞춤 블록 또는 표준 블록으로 렌더링되는 카테고리 페이지입니까? 커스텀 체크 또는 포스트 getLoadedProductCollection 인 경우 –