Subrata
Subrata

Reputation: 2284

How to add product thumbnail image to order review page in Magento?

I am trying to show image thumbnail of products in order view page. For this I am using this line

<img src="<?php echo Mage::helper('catalog/image')
->init($_item,'small_image')
->resize(50); ?>" width="50" height="50" alt="" />

in this file

template/sales/order/items/renderer/default.phtml

what I get is the blank image of magento, this one --> enter image description here

On firebug I get the image url as below

src="http://my_Website.com/media/catalog/product/cache/1/small_image/50x/9df78eab33525d08d6e5fb8d27136e95/images/catalog/product/placeholder/small_image.jpg">

this is where that blank image is coming from.

Can anyone explain what's happening here and what's the possible solution.

Thank You very much in advance.

Upvotes: 2

Views: 10924

Answers (3)

SIL
SIL

Reputation: 185

This code is working fine try :

if($_item->getProductType() == 'configurable') {
    $_product = $_item->getProduct();
}else{
    $_product = Mage::getModel('catalog/product')->load($_item->getId());
}

?>
<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />

Upvotes: 1

Noufal
Noufal

Reputation: 131

Try the codes given below:

First load the product

$_product = Mage::getModel('catalog/product')->load($_item->getProductId()); 

Then show the thumbnail where you want using the code given below

<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75, 75); ?>" alt="<?php echo $this->htmlEscape($_item->getName()); ?>" border="0" width="75" />

Upvotes: 7

feeela
feeela

Reputation: 29932

Make sure you have checked the appropriate radio button on the products media tab. There are three columns (Base Image, Small Image, Thumbnail) that need to be set to use that image as a thumbnail.

Upvotes: 0

Related Questions