Brandammo

Blog

Output more than one image per product on list (category page) of Magento.

For a project I needed to find a way to pull out more than one image per product in list.phtml (category page) but also pulling out a certain size , the below code allows you to load all the images for that specific product, you can then manipulate the image either adding classes to it or adding inline styles.

<?php
                		//get images for product
	                	$product = Mage::getModel('catalog/product')->load($_product->getId());
						$helper = Mage::Helper('catalog/image');
		                foreach ($product->getMediaGalleryImages() as $image) {
		                    echo "<img src='" . $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $image->getFile())->resize(243) . "' />";
		                }
	                ?>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>