magento 输出关联产品

如下:

 
<?php
$related= $_product->getRelatedProducts();
foreach($related as $_item):
    $_item = $_item->load($_item->getId());
    //echo $this->htmlEscape($_item->getName()).': <a href="'.$_item->getProductUrl().'"><img src="'.$_item->getImageUrl().'" width="80" height="80" /></a>';
    echo $this->htmlEscape($_item->getName()).': <a href="'.$_item->getProductUrl().'"><img src="'.Mage::helper('catalog/image')->init($_item, 'thumbnail')->resize(80, 80).'" width="80" height="80" /></a>';
endforeach;
?>
 

参考: http://stackoverflow.com/questions/8681945/how-to-display-related-products-in-ajax-pop-up-in-magento

你可能感兴趣的:(agent)