Magento Checkout Redirects Back to Cart Page

Recently we had the task of transferring a Magento Installation over from a CPanel server to a Plesk server. The transfer would have been rather textbook if not for the failure on the onepage checkout after the transfer was complete.

Symptom:
After transferring to the new server, when placing an order the checkout page would always redirect to the cart page rather than complete the order. No error messages or exceptions displayed by Magento.

What Happened Next?
The logs, always the logs. Actually no, we wasted a little time checking nothing had been hard coded into the javascript files used by the one page checkout, as we had not created it originally. That was to no avail, so then we checked the logs and found the following in var/log/system.log:

[code]2011-05-30T21:55:20+00:00 ERR (3): Notice: Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH' in /www/domain.com/httpdocs/lib/Varien/Crypt/Mcrypt.php on line 56
2011-05-30T21:55:20+00:00 ERR (3): Notice: Use of undefined constant MCRYPT_MODE_ECB - assumed 'MCRYPT_MODE_ECB' in /www/domain.com/httpdocs/lib/Varien/Crypt/Mcrypt.php on line 60[/code]

Instantly twigged that php5-mcrypt was not installed on the server. As Magento was not installed via the installer and transfered instead this was not spotted sooner.

Installed php5-mcrypt and the onepage checkout worked once again. Another successful transfer. Another happy client.

If you have the same issue, around a year ago we coincidently wrote a blog post on how to install php5-mycrypt on a linux server. It may be some use to you in this situation.


6 comments

Comment from: Joel [Visitor]
Just wanted to say thanks. I found this post pretty quickly via Google and it turned out to be my issue. I'm new to Mag. so this would have taken me eons to sort out otherwise. Thanks for taking the time to post it.
03/05/12 @ 15:43
Comment from: James [Member] · http://www.madcapsule.com
Thanks for your comment, Joel. Glad it helped you :)
03/05/12 @ 16:54
Comment from: Ravi soni [Visitor] Email
A very thanks for this rare helpful post i found for my solution.
But in our installation we have found the same thing as onepage checkout redirecting to cart page again i checked my phpinfo and found mcrypt is enabled.
Our installation was working fine but eventually it started throwing some error (Exception) across the whole store please help me in this as i have completely off after trying 1000E times for the solution
04/09/12 @ 08:15
Comment from: James [Member] · http://www.madcapsule.com
Hi Ravi,

Paste the exception your seeing + a tail of your system.log file to pastebin and put the link here and we can take a look into what may be causing your issue.

Cheers
04/09/12 @ 14:47
Comment from: Mathias [Visitor] · http://icandy.com.br
Hello James!
I reached your site while trying to find a solution for our issue, but it seems that your solution didn't work for us! Our problem is the same, after Placing Order, costumer is redirected to Cart, rather than completing the order. What is weird is that evertyhing was working fine, and suddenly this problem started to happen. Could you take a look for us, please?
http://pastebin.com/i1qSEjvw Thank you very much!
03/10/12 @ 19:47
Comment from: James [Member] · http://www.madcapsule.com
Hi Mathias,

Do you have any alterations to your checkout or any other extensions installed, even if not related to the checkout process?

Cheers
04/10/12 @ 14:36

This post has 7 feedbacks awaiting moderation...

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)