Get the object of the whole quotation in observer
-
22-10-2019 - |
Question
I am doing this:
public function setQuoteShippingMethod (Varien_Event_Observer $observer) {
$item = $observer->getEvent()->getQuoteItem();
//to have more code
}
but it takes the last item (product) in the quotation (i.e. I have 4 items). I want to take the object of the whole quotation (bundle product), so I manipulate its shipping method.
I am observing checkout_cart_product_add_after
. The point is - I have a quotation in the Customer Account's quotes - and when you open(view) the quotation - you can click "Add to cart". That's where my method is caught.
Solution
Based on the comments it seams that this solves the problem:
$item = $observer->getEvent()->getQuoteItem();
$quote = $item->getQuote()
//do stuff with $quote
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange