Goto admin>System>Configuration>Checkout>Shopping Cart>Configurable Product Image
make it Product Thumbnail Itself
this make child product image
Instead of sending
$_item->getProductId()
send $_item
and put somelogic
$_item
for configurable product $_Item>getSku give child product a other time give main products.
so just child product using item sku
I guess you have used third party extension so i have change some change according my concept
change
Step1:instead of send product send all item object
findColorImage($_item->getProductId(),$product_base,'color', 'image');
to
findColorImage($_item,$product_base,'color', 'image');
Step2: some change on function
public function findColorImage($item, $arr, $key, $type)
{
/* $value set here*/
$value=$item->getProductId();
$found = '';
if(isset($arr[$key])) {
$total = count($arr[$key]);
if($total>0)
{
for($i=0; $i<$total;$i++)
{
if($value == ucwords($arr[$key][$i]))//if it matches the color listed in the attribute
{
$found = $arr[$type][$i];//return the image src
}
}
}
}
if ($found == '') {
if (isset($arr['image'])){
$found = $arr['image'][0];
}
}
/* for configurable product send child product image */
if($item->getProductTypeId="configurable"){
$ChildProduct=Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());
$found=Mage::helper('catalog/image')->init($ChildProduct, 'thumbnail');
}
return $found;
}
Faced same problem today, I fixed it by Overriding core files
Copy
app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php
to
app/code/local/Mage/ConfigurableSwatches/Helper/Mediafallback.php
and change line number 61 from
$optionLabels += $attribute->getOptionLabels();
to
$optionLabels = array_merge($optionLabels, $attribute->getOptionLabels());
this will solve this error.
Best Answer
The methods available in the helper you mentioned allows you to retrieve the image urls for the configurable swatches. For example the url of pink/white/blue swatch url for a super attribute such as color (ex: media/catalog/swatches/1/21x21/media/pink.png). You can check in
.../configurable/swatches.phtml
how is being used by the core:$_swatchUrl = Mage::helper('configurableswatches/productimg') ->getSwatchUrl($_product, $_option->label, $_swatchInnerWidth, $_swatchInnerHeight, $_swatchType);
But you want to take the image of a parent/configurable product so just follow the code from
.../catalog/product/view/media.phtml
src="<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>"
which is retrieving the image of the product in the product view/page.
Note: above sample of codes were taken from Magento ver. 1.9.2.4