I have an observer (checkout_cart_product_add_after) and would like to get the selected custom options array.
I have found the two elements I require in:
app/design/frontend/MY-THEME/default/template/checkout/cart/item/default.phtml
Which are:
1. $_item = $this->getItem(); 2. $_options = $this->getOptionList();
I just don't know how to get them in an observer i.e. what else I have to call.
Thanks in advance!!
please go to the following url
http://inchoo.net/magento/updating-options-of-configurable-product-that-is-already-in-the-cart/
thanks
</div>
Observers always start returning data from their respective "events".
So in your case you have to first get checkout-quote object in your observer's function code using below line:
$quote = $observer->getEvent()->getQuote();
Then you can get custom options for each item in items collection from the quote like below:
$quoteItems = $quote->getAllItems();
$helper = Mage::helper('catalog/product_configuration');
foreach ($quoteItems as $item) {
$product = $item->getProduct();
$options = $helper->getCustomOptions($item);
//do anything with $options.
}
Try this. hope it helps.
Also have you already referred below links ?
https://magento.stackexchange.com/questions/16804/get-the-object-of-the-whole-quotation-in-observer
https://magento.stackexchange.com/questions/6368/how-to-get-selected-custom-options-on-onepage