When I select a child product of a configurable product, and add it to the cart the correct simple child product image is displayed in the cart.

However if I add the same child product to the wishlist, the parent configurable product image is displayed.

I found the setting in Magento back end that controlled which image would be displayed in the cart, but I couldn't find a similar setting for the wishlist.

I also have been trying to fix this situation by changing the code in


However I have been unsuccessful.

Any help would be appreciated! Thanks

This is the code I have done so far; however now I don't have any image being displayed in my Wishlist. The file I am modifying is


and code is below

$item = $this->getItem();
$product = $item->getProduct();
$item_s = Mage::getModel('wishlist/item')->loadWithOptions($item->getId(), 'simple_product')->getOptionsByCode();
$simple_product = $item_s['simple_product']->getData();
$simple_product_id = $simple_product_data['product_id'];
$simple_product_attr = Mage::getModel('catalog/product')->load($simple_product_id);
<a class="product-image" href="<?php echo $this->getProductUrl($item) ?>" title="<?php echo $this->escapeHtml($product->getName()) ?>">
     <img src="<?php echo $this->helper('catalog/image')->init($simple_product_attr ,'small_image'); ?>" alt="<?php echo $this->escapeHtml($product->getName()) ?>" />

Also here is the code with extraneous code removed:

$item = $this->getItem();
$product = $item->getProduct();
$item_s = Mage::getModel('wishlist/item')
     ->loadWithOptions($item->getId(), 'simple_product')
$simple_product = $item_s['simple_product']->getData();
$simple_product_id = $simple_product_data['product_id'];
$simple_product_attr = Mage::getModel('catalog/product')
<img src="<?php echo $this->helper('catalog/image')
    ->init($simple_product_attr ,'small_image'); ?>" />
  • Can you show what you've tried, it can be a simple fix. – Melvyn Mar 10 '15 at 20:00
  • @Melvyn sure. I edited my original post to show what I have done so far. I have also tried using getThumbnail() from the checkout for a while, but have given up on that approach since three files are required for that function. – SeanM Mar 10 '15 at 22:34
$_product_id = $item->getData('product_id');
$_simple_product_id = Mage::helper('nhuthep')->getSimpleProductIdInWishlist($item->getData('wishlist_item_id'), $_product_id);
if ($_product_id != $_simple_product_id) {
    $_simple_product = Mage::getModel('catalog/product')->load($_simple_product_id);

if (isset($_simple_product) && $_simple_product->getId()) {
    $_small_image = $this->helper('catalog/image')->init($_simple_product, 'small_image');
} else {
    $_small_image = $this->helper('catalog/image')->init($product, 'small_image');

with helper nhuthep I have a function getSimpleProductIdInWishlist like this:

public function getSimpleProductIdInWishlist($wishlistItemId, $itemProductId)
   $wishlistItemOptions = Mage::getModel('wishlist/item_option')
      ->addFieldToFilter('wishlist_item_id', $wishlistItemId);

   foreach ($wishlistItemOptions as $option) {
       $optionProductId = $option->getProductId();
       if ($optionProductId != $itemProductId) {
           return $optionProductId;

   return $itemProductId;

You can also get product name or product url of child product.


In default Magento you can select which you want to show in the Cart.

Goto System / Configuration -> Sales/Checkout -> Checkout -> Configurable product image

Change to Parent Product Thumbnail or Product Thumbnail self and do not change anything yourself.

  • This will work only for the Shopping Cart images. Not for the Wishlist pages. – PHP Bugs Apr 21 '15 at 10:44
  • Then you should do a minor change in copy/pasting from cart/items.phtml -> wishlist... – Jeroen Apr 29 '15 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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