如下:
list.phtml
<?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
任一位置:
$model = Mage::getModel('catalog/product');
$product = $model->load($product_id);
// Get all related product ids of $product.
$allRelatedProductIds = $product->getRelatedProductIds();
foreach ($allRelatedProductIds as $id) {
$relatedProduct = $model->load($id);
// get Product's name
echo $relatedProduct->getName();
// get product's short description
echo $relatedProduct->getShortDescription();
// get Product's Long Description
echo $relatedProduct->getDescription();
// get Product's Regular Price
echo $relatedProduct->getPrice();
// get Product's Special price
echo $relatedProduct->getSpecialPrice();
// get Product's Url
echo $relatedProduct->getProductUrl();
// get Product's image Url
echo $relatedProduct->getImageUrl();
}
参考:http://magento.stackexchange.com/a/14627
本文:http://justcoding.iteye.com/blog/1706579