I'm trying to show the correct image for each product that is in the shopping cart (One Step Checkout). Currently when a customer chooses a product, if the product has multiple colour options, it loads the configurable product thumbnail.

So if a customer has the option between a black and red shirt, if they choose the red one, it should show the red shirt thumbnail, and vice verse. I've investigated some other posts:

Post One, Post Two

However none of the solutions worked. I have System > Configuration > Checkout > Shopping Cart > Configurable Product Image > "Product Thumbnail Itself"

Currently I try to retrieve the image by doing the following in checkout/cart/item/default.phtml :


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

     data-image2x="<?php echo $this->getProductThumbnail()->resize(200, 300); ?>"
     src="<?php echo $this->getProductThumbnail()->resize(100, 150); ?>"
     alt="<?php echo $this->htmlEscape($this->getProductName()) ?>"


Can anyone help my solve this? Thanks!

1 Answer 1


Because we are using CJM Color Selector Plus extension for the color swatches, I had to use a work-around in pulling code from that module to come up with the following:

$product_image = '';

//Start check for correct thumbnail image
$_formatedOptionValue = '';
$configAttributes = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);
$colorAttr = $configAttributes[0];

if ($_options = $this->getOptionList()) {

    $_formatedOptionValue = $this->getFormatedOptionValue($_options[0]);


foreach ($colorAttr["values"] as $value) {

    if($_formatedOptionValue['value'] == $value["label"]) {
        $product_base = Mage::helper('colorselectorplus')->decodeImages($_product);
        $product_image = Mage::helper('colorselectorplus')->findColorImage($value['value_index'], $product_base, 'color', 'thumb');

//End check for correct thumbnail image 

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.