I'd like to show the product thumbnail in the new orders emails. I tried this code:

<img src="<?php echo Mage:: getThumbnail('catalog/product_media_config')
             ->getMediaUrl($_product->getThumbnail()); ?>" alt="<?php echo $_item->getName() ?>" />

It doesn't work. Any helps?


3 Answers 3


For thumbanil it is compulsory to select thumbnail image at back end other wise you get default image

you can fetch main image and resize that image for your requirement

 <?php echo Mage::helper('catalog/image')->init($_product, 'image')->resize($size)->__toString(); // here $size is your image size ?>  

Try below solution may it works

$backendModel = $collection->getResource()->getAttribute('media_gallery')->getBackend();

and then try below code

 <?php echo Mage::helper('catalog/image')->init($_product, 'image')->resize($size)->__toString(); // here $size is your image size ?>    

Try replacing your code,

<img src="<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl($_product->getThumbnail()); ?>"  width="135" height="135" alt="<?php echo $_item->getName() ?>" />


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

You can use thumbnail or image or small_image.
Refresh your Image Cache.


Well, I think you should detail a little bit more your question, e.g. I don't know where did you place the code you mention. Anyway, have you tried to do this:

In the file


which should be based on


you can place this code after <?php $_order = $this->getItem()->getorder(); ?>

<?php $_product = Mage::getModel('catalog/product')

and then, wherever you want to place your product image you should place

<img src="<?php echo Mage::getModel('catalog/product_media_config')
             ->getMediaUrl($_product->getThumbnail()); ?>" 
             alt="<?php echo $_item->getName() ?>" />

Hope this helps you!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.