Magento 1.9 Cart Images Not Displaying – How to Resolve

cartimagemagento-1.9

I seem to have lost my images from my cart page and also the mini cart at the top of the screen. When i go into a product and add to the cart then view the mini cart (hover over cart icon) then the image is displaying perfectly with the source

<img src="http://www.domain.com/media/catalog/product/cache/1/thumbnail/50x50/4c28172cd5b58975125070293f464017/h/a/hat_101.gif" data-srcx2="http://www.domain.com/media/catalog/product/cache/1/thumbnail/100x100/4c28172cd5b58975125070293f464017/h/a/hat_101.gif" width="50" height="50">

But then when i click on the cart to view the basket the image disappear and is replaced with the magento placeholder

<img src="http://www.domain.com/media/catalog/product/cache/1/thumbnail/50x50/d2ef8acc7d0030db8e2cfcc27e37649a/images/catalog/product/placeholder/thumbnail.jpg" data-srcx2="http://www.domain.com/media/catalog/product/cache/1/thumbnail/100x100/d2ef8acc7d0030db8e2cfcc27e37649a/images/catalog/product/placeholder/thumbnail.jpg" width="50" height="50" >

The line that calls the product image says,

<td class="td-image"><img src="<?php echo $this->getProductThumbnail()->resize($imgX,$imgY); ?>" data-srcX2="<?php echo $this->getProductThumbnail()->resize($imgX*2,$imgY*2); ?>" width="<?php echo $imgX;?>" height="<?php echo $imgY;?>" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></td>

which if i am correct should get the product image thumbnail, resize it and display it?

Does anybody know what is going wrong here and why i am losing my image every time i refresh the page or click onto the cart page.

Thank you

Best Answer

You can use the catalog image helper to get any type of image.

$_product = $_item->getProduct();
echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(50,50);
Related Topic