Mini-Cart displaying Parent Product Image instead of Product Image
The block Mage_Checkout_Block_Cart_Item_Renderer
has a function overrideProductThumbnail
which will update which thumbnail to be used when rendering a product in the cart.
During the _toHtml
of the grouped product renderer Mage_Checkout_Block_Cart_Item_Renderer_Grouped
this is called.
protected function _toHtml()
{
$renderer = $this->getRenderedBlock()->getItemRenderer($this->getItem()->getRealProductType());
$renderer->setItem($this->getItem());
$renderer->overrideProductThumbnail($this->getProductThumbnail());
$rendererHtml = $renderer->toHtml();
$renderer->overrideProductThumbnail(null);
return $rendererHtml;
}
It would seem to me that you have not added the correct item renderers for these product types. See the layout xml file app/design/frontend/base/default/layout/checkout.xml
for how this can be achieved.
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
<block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
<label>Shopping Cart Sidebar Extra Actions</label>
</block>
</block>
For me the issue was in
Mage_Catalog_Model_Product_Type_Configurable::getProductByAttributes
I needed to override method and add 'thumbnail' to the select. I.e.
$productCollection = $this->getUsedProductCollection($product)->addAttributeToSelect('name')->addAttributeToSelect('thumbnail');
EE 1.14.x