2011-08-23 128 views
1

我有以下要求;Magento查看list.phtml中的相關產品

我想在類別列表頁(list.phtml)上顯示配置產品的相關產品。 我想我可以使用[b] $ _ product [/ b]變量爲每個產品的每個循環中的list.phtml中的某個調用,但我似乎無法填充relatedProductCollection 對不起,這一切都是新的它甚至有可能。

<?php foreach ($_productCollection as[b] $_product[/b]):?> 
    <li class="item<?php if(++$_iterator == sizeof($_productCollection)): ?>last<?php endif; ?>" > 
     <div class="product-shop"> 
      <div class="f-fix"> 


        <?php $product->getRelatedProductCollection(); ?> 


    </li> 
<?php endforeach; ?> 

回答

1

$產品已經被用來調用getRelatedProductCollection功能。

但是,

在你已經採取它作爲$ _產品是foreach循環。

你能看出區別嗎?

下劃線缺失。這是從您的代碼中獲取的。使這兩個地方的變量相同並嘗試。