Created
January 2, 2013 15:14
-
-
Save mklooss/4435272 to your computer and use it in GitHub Desktop.
Magento do not merge Customer Quote, if current quote is not empty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Observer { | |
| public function load_customer_quote_before($observer) | |
| { | |
| $checkout_session = $observer->getEvent()->getCheckoutSession(); | |
| if($checkout_session->getQuote()->getItemsCount() < 1) // check if current quote has items | |
| { | |
| return $this; | |
| } | |
| $customerQuote = Mage::getModel('sales/quote') | |
| ->setStoreId(Mage::app()->getStore()->getId()) | |
| ->loadByCustomer(Mage::getSingleton('customer/session')->getCustomerId()); | |
| $customerQuote->delete(); | |
| return $this; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Event in File: app/code/core/Mage/Checkout/Model/Session.php
in Method: loadCustomerQuote
Mage::dispatchEvent('load_customer_quote_before', array('checkout_session' => $this));