cancel
Showing results for 
Search instead for 
Did you mean: 

Some Customer cannot login in frontend; error when create new Quote

Some Customer cannot login in frontend; error when create new Quote

Some accounts of a store (not all ) can not log into the frontend. It's not show any error, simply stay thinking a long time, and then browser show that it could not load the page. After long time to debug, I discovered that it breaks when creating a new Quote to a customer who does not have it, more specifically in this method of file /app/code/core/Mage/Sales/Model/Quote.php:

 

    /**
     * Save related items
     *
     * @return Mage_Sales_Model_Quote
     */
    protected function _afterSave()
    {
        parent::_afterSave();

        if (null !== $this->_addresses) {
            $this->getAddressesCollection()->save();
        }

        if (null !== $this->_items) {
            $this->getItemsCollection()->save();
        }

        if (null !== $this->_payments) {
            $this->getPaymentsCollection()->save();
        }
        return $this;
    }


When apply the save in $this->getAddressesCollection()->save(); here is where ocurrs. It only happend with some accounts, and I could not identify what is the cause. Does anyone know what could be?

2 REPLIES

Re: Some Customer cannot login in frontend; error when create new Quote

Did you try add information of address for this accounts? I think this accounts not have information of address billing or shipping.

Re: Some Customer cannot login in frontend; error when create new Quote

looks like sesson hijacked, so its trying to save customer A's address as current customer B, and when saving address, theres infinite loop (trying to save customer A and B back and forth)

 

this might fix the error

        if (null !== $this->_addresses) {
            foreach($this->getAddressesCollection() as $address) {
                if(($customerId = $address->getCustomerId()) && $customerId !== $this->getCustomerId()) {
                    continue;
                }
                $address->save()
            }
        }

for the real fix, you have to find out why its saving other's address