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.
- I am on checkout page and on order review step and selected COD payment method
- 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!
Best Answer
Finally, I figured out root cause. Every questions answered by following
preDispatch()
function written inOnepageController
(app\code\core\Mage\Checkout\controllers\OnepageController.php
)If you further look into
_canShowForUnregisteredUsers()
functionThis code is checking following configuration:
So
checkout/onepage/success
is not allowed for unregistered user, sonorouteAction()
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 writingObserver
to check checkoutpreDispatch
event and write needed code. check here for list of Magento events.