0

I am using Magento 1.9.2.4 and default onepage checkout. I am facing issue when customer already on checkout page and click on place order but session was got timeout before placing order. Below is scenario:

My session time out set from backend is 3600sec.

  1. I am on checkout page and on order review step and selected COD payment method
  2. I waited for 1hr then I clicked on place order button, My order got placed and redirect to checkout/onepage/success and throws 404 because customer session was timed out.

If I visit this url http://domain.com/checkout/onepage/success directly in address bar if customer is not logged then magento throwing 404 error page.

I have configure in backend system > configuration > checkout > allow guest checkout > No and system > configuration > checkout > Require Customer To Be Logged In To Checkout > Yes

When I changed Yes to No for Require Customer To Be Logged In To Checkout then it's working fine.

Why Magento treating success page url as 404 error page when customer session timed out and setting for Require Customer To Be Logged In To Checkout is set to Yes?

Any help appreciated!

1 Answer 1

2

Finally, I figured out root cause. Every questions answered by following preDispatch() function written in OnepageController (app\code\core\Mage\Checkout\controllers\OnepageController.php)

    if (!$this->_canShowForUnregisteredUsers()) {
        $this->norouteAction();
        $this->setFlag('',self::FLAG_NO_DISPATCH,true);
        return;
    }

If you further look into _canShowForUnregisteredUsers() function

protected function _canShowForUnregisteredUsers()
{
    return Mage::getSingleton('customer/session')->isLoggedIn()
        || $this->getRequest()->getActionName() == 'index'
        || Mage::helper('checkout')->isAllowedGuestCheckout($this->getOnepage()->getQuote())
        || !Mage::helper('checkout')->isCustomerMustBeLogged();
}

This code is checking following configuration:

 system > configuration > checkout > allow guest checkout > No
 system > configuration > checkout > Require Customer To Be Logged In To Checkout > Yes

So checkout/onepage/success is not allowed for unregistered user, so norouteAction() method redirecting to 404 error page.

To fix this issue if you are using above settings then you can override preDispatch() method of checkout onepage controller or writing Observer to check checkout preDispatch event and write needed code. check here for list of Magento events.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.