Magento – Adding Product Image in My Product Reviews page

product-imagesreview

friends. How to add product images on the My Product Reviews page like this mockup design

My Product Reviews page with product images

Best Answer

The product collection with the reviews is built in Mage_Review_Block_Customer_List::_construct() but the collection contains only the name attribute of the product.
So you need to rewrite that method and add the image attribute.
So create your module and add this in the config.xml

<blocks>
     <review>
         <rewrite>
             <customer_list>[Namespace]_[Module]_Block_Customer_List</customer_list>
         </rewrite>
     </review>
</blocks>

then create the file [Namespace]/[Module]/Block/Customer/List.php with this content

<?php 
class [Namespace]_[Module]_Block_Customer_List extends Mage_Review_Block_Customer_List
{
    protected function _construct()
    {
        parent::_construct();
        $this->collection->addAttributeToSelect('image');
    }
}

Then in the template app/design/frontend/{package}/{theme}/template/review/customer/list.phtml add this to get the image where ever you need it like this:

<img src="<?php echo $this->helper('catalog/image')->init($_review, 'image')->resize(200,150)?>" alt="<?php echo $this->escapeHtml($_review->getName())?>" />

Feel free to change the size of the image to what ever you need.