Question

I am looking for an answer for this weird issue but can't find anything that helps.

I have magento enterprise edition 1.14.0.1 and some customers aren't able to login into their account area for particular store website. Website just hangs and show the login page or this error page enter image description here

If I open the particular customer from admin : Dashboard -> Customers -> Manage customers -> edit particular customer. Issue get resolve for that particular customer.

I am using redis for backend session/cache and default FPC.

Any suggestion would be appreciated.

Was it helpful?

Solution

After a long debug, Issue has get resolved. It was happening due to trigger_recollect field in quote.

Class Mage_Sales_Model_Resource_Quote.php

I have put if($data['trigger_recollect'] == 1){ } in loadByCustomerId method.

Customer those have $data['trigger_recollect'] = 0 were not able to logged in.

updated method

/**
     * Load quote data by customer identifier
     *
     * @param Mage_Sales_Model_Quote $quote
     * @param int $customerId
     * @return Mage_Sales_Model_Resource_Quote
     */
    public function loadByCustomerId($quote, $customerId)
    {

        $adapter = $this->_getReadAdapter();
        $select  = $this->_getLoadSelect('customer_id', $customerId, $quote)
            ->where('is_active = ?', 1)
            ->order('updated_at ' . Varien_Db_Select::SQL_DESC)
            ->limit(1);

        $data    = $adapter->fetchRow($select);

        // additional code 
        if($data['trigger_recollect'] == 1){
            $entityIds = $this->_getReadAdapter()->fetchCol($select);
           // Mage::log($entityIds,null,'customAmit.log');
            if (count($entityIds) > 0) {
                $where = $this->_getWriteAdapter()->quoteInto('entity_id IN (?)', $entityIds);
                $this->_getWriteAdapter()->update($this->getTable('sales/quote'), array('trigger_recollect' => 0), $where);
            }
        }
        // additional code

        if ($data) {
            $quote->setData($data);
        }

        $this->_afterLoad($quote);


        return $this;
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top