Php – Magento onepage checkout saveOrder 302 redirect

magentomagento-1.8PHP

Running a new Magento 1.8 install and on the onepage checkout, at the final review when the user submits the order, there's an ajax request for http://www.domain.com/checkout/onepage/saveOrder/. The status code for this request is 302 Found and the response is null (and it should be {"success":true,"error":false}).

I don't know how it gets a 302 when it should be a 200 status. Any ideas?

Best Answer

Ran across this tip that fixed it for me. Essentially it looks like they forgot to include the formKey in the saveOrder ajax request.

Find app / design / frontend / (template name) / template / checkout / onepage / review / info.phtml and around line number 60 replace...

    <script type="text/javascript">
        //<![CDATA[
            review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
        //]]>
    </script>

...with this...

    <script type="text/javascript">
    //<![CDATA[
        review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
    //]]>
    </script>