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

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

-1
public function yourObserverFunction(Varien_Event_Observer $observer) {     
    $product = $observer->getEvent()->getProduct();
    var_dump($product->getId());
    var_dump($product->getName());die;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.