4

While trying to answer this question I ran into a strange behavior.

The checkout_cart_add_product_complete event is working nice while adding a product to cart from a catalog. However if I try to move product to cart from a wishlist the event doesn't fire.

The reason for it Mage_Wishlist_IndexController::cartAction() is adding product to cart through Mage_Checkout_Model_Cart::addProduct() method and not through cart controller (where checkout_cart_add_product_complete is firing).

So the question is if it was made intentionally or is it a bug?

  • Is there an issue with observing checkout_cart_product_add_after event instead? It's just upstream. – benmarks Feb 27 '13 at 13:02
  • @benmarks: sure, but checkout_cart_add_product_complete is much more tasty as it already has request instance inside :-) – user487772 Feb 27 '13 at 13:08
  • I see. Still, the request object is just a quick Mage::app()->getRequest() call away, same as it was retrieved by Front Controller. I think you and I prefer to not tie observers to request if it's not already done. :-) – benmarks Feb 27 '13 at 13:27
  • @benmarks: (more upstream) checkout_cart_product_add_after was not suitable with the mentioned question as redirect was required there. The solution was using postDispatch. – user487772 Feb 27 '13 at 14:02
  • 2
    Where would we be without those full action name events?! – benmarks Feb 27 '13 at 15:29
3

Judging from this comment in CartController.php:

/**
 * @todo remove wishlist observer processAddToCart
 */

This it definitely a legacy bug.

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.