Question

In my magento website, "Guest Checkout" is disabled. People need to register while they checkout. This works fine, as it is a default behaviour. But sometimes, people who register are not really registered, but considered as Guest.

This happens randomly. I don't have any idea what is going wrong. Can anyone help please?

note:

The website uses the default onepage checkout with minor modifications only in templates (jQuery additions for some attractive UI).

the output of running SELECT * FROM customer_group is:

enter image description here

running SELECT * FROM core_config_data WHERE path = 'customer/create_account/default_group' returned empty set.

Was it helpful?

Solution

At last found the problem, there was a custom modification, which didn't throw an exception, when already registered customer tries to register again. So, that customer was considered as a Guest [NOT LOGGED IN] customer.

The bad part is that, it was straight away done in core files, so I didn't find it until now.

I didn't want to mess up with these changes, so created an event-observer to automatically login, if the customer is already registered.

if(!Mage::helper('customer')->isLoggedIn()){
    $data = $evt->getEvent()->getControllerAction()->getRequest()->getPost('billing', array());
    $customer = Mage::getModel("customer/customer");    
    $email = $data['email']; //email entered in billing address section
    $customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email);

    if($customer->getId()){
        Mage::getSingleton('customer/session')->loginById($customer->getId());
    }
}

OTHER TIPS

You need to clear your cache and reindex the website. Flush all of the caches.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top