0

I have a configurable product and I want to capture the data of the associated product which is added to cart.

http://manoolia.dmcs-online.com/zig-zag-configurable?___store=english&___from_store=english

On this example, when you chose green and add it to cart, a popup will display with the red image(configurable product image). I want to get the associated product image etc.

Any idea?

2 Answers 2

1

If you want to show simple product thumbnail in shopping cart than you can change configuration on below path:

you will find this option in shopping cart section as define below.

system->configuration->sales->checkout->shopping cart tab.

system->configuration->sales->checkout->shoppingcart

2
  • If you found answer helpful than please accept it. Jan 23, 2015 at 15:20
  • Thanks, but although similar, this is not what I wanted. Jan 23, 2015 at 15:37
0

Have a look in Mage_Sales_Model_Quote_Item_Abstract::getChildren, you should be able to use it to get the first child of a configurable which will be it's associated simple, then get whatever data you require.

Something like the following:

$helper = Mage::helper('catalog/image');

//However you get the quoteItem, it goes here!
$quoteItem = Mage::getModel('sales/quote_item');

$imageUrl = $helper->init($quoteItem->getProduct(), 'small_image');

if ($quoteItem->getData('product_type') == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {

    $children = $quoteItem->getChildren();
    $childQuoteItem = reset($children);
    if ($childQuoteItem) {
        $imageUrl = $helper->init($childQuoteItem->getProduct(), 'small_image');
    }
}
6
  • This code gets all children? Jan 23, 2015 at 15:35
  • Calling reset on it will get the first child, which will be the simple of the configurable Jan 23, 2015 at 16:03
  • Tried your code but it throws an error. Also tried with $_product->getChildren() but doesn't get any. Jan 23, 2015 at 17:59
  • Product get children willnae work. What error is thrown? Jan 24, 2015 at 0:11
  • Fatal error: Call to a member function setFinalPrice() on a non-object in /home/manoolia/public_html/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php on line 89 Jan 28, 2015 at 11:12

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.