The implementation of the
Mage_Checkout_Model_Cart::save() method seems to result in duplication of events. Why is the non-standard
checkout_cart_save_after event thrown immediately after the generic
sales_quote_save_after event would have been thrown by the successful save.
Are there are reasons to listen for one of the events instead of the other? I can see that the
sales_quote_save_after event would be thrown by admin or API orders, but they can be excluded from observers via specifying the eventname inside the
<frontend> XML node in the module's config.xml anyway.
To provide a more concrete reason for the question, we have inherited code that listens to the
checkout_cart_save_after event and I am concerned that it might be missing scenarios when the quote is changed but that event is not thrown.
Reference code from /app/code/core/Mage/Checkout/Model/Cart.php:473:
Mage::dispatchEvent('checkout_cart_save_before', array('cart'=>$this)); $this->getQuote()->getBillingAddress(); $this->getQuote()->getShippingAddress()->setCollectShippingRates(true); $this->getQuote()->collectTotals(); $this->getQuote()->save(); $this->getCheckoutSession()->setQuoteId($this->getQuote()->getId()); /** * Cart save usually called after changes with cart items. */ Mage::dispatchEvent('checkout_cart_save_after', array('cart'=>$this));