Can you suggest a php code in order to show the image of a related product
I am using this code in view.phtml
<?php $related_prods = $_product->getRelatedProductIds();
foreach($related_prods as $related){
$_rel = Mage::getModel('catalog/product')->load($related);
echo $_rel->getName() . " " . $_rel->getImageUrl();
} ?>
I am just getting the url of the image that I want but I want to show the image itself !
Can you suggest of something?
<?php $related_prods = $_product->getRelatedProductIds(); ?>
<?php foreach($related_prods as $related): ?>
<?php $_rel = Mage::getModel('catalog/product')->load($related); ?>
<?php echo $_rel->getName(); ?>
<img src="<?php echo $_rel->getImageUrl(); ?>"/>
<?php endforeach; ?>
In other words: use the HTML <img>
-tag...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.