Posts

Showing posts from October, 2010

Dont want to merge old carts items with current quote

Hi,guys Here i explain how you can prevent the cart from the old session from merging into the cart of the current session at the point when the customer login. Problem is, that a customer could basically be done shopping, logs in to their account and their cart gets filled with their old “last logged in” cart items as well as the ones they just recently picked. To prevent this from happening, here’s what I did The function loadCustomerQuote() in the observer observes the event customer_login and merges the current session quote with the last login quote object. you can see  loadCustomerQuote() in : Mage_Checkout_Model_Observer. Mage_Checkout_Model_Session. public function loadCustomerQuote() { $customerQuote = Mage::getModel('sales/quote') ->setStoreId(Mage::app()->getStore()->getId()) ->loadByCustomer(Mage::getSingleton('customer/session')->getCustomerId());   if ($this->getQuoteId() != $customerQuote->getId()) { $this->