0

I'm observing the checkout_cart_add_product_complete event and need to get the added quote item.

There was a previous post on this issue with a suggestion to flag the new quote item in checkout_cart_product_add_after and then access it in checkout_cart_add_product_complete.

My question is on a basic level - how exactly do I implement this solution if I only get passed the product in checkout_cart_add_product_complete?

Link to previous post: Watching Add to Cart Event - quote item id is empty

Manashvi Birla
  • 8,833
  • 9
  • 27
  • 53
chaya
  • 1
  • 1
  • 2

2 Answers2

1

You get the quote by:

$quote = Mage::getSingleton('checkout/cart')->getQuote();

then you have access to all items:

$quote->getAllItems()

And follow the instructions of the original answer

Fabian Schmengler
  • 65,791
  • 25
  • 187
  • 421
-1
public function yourObserverFunction(Varien_Event_Observer $observer) {     
    $product = $observer->getEvent()->getProduct();
    var_dump($product->getId());
    var_dump($product->getName());die;
}
Arithran
  • 109
  • 4