Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento onepage checkout saveOrder 302 redirect

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?

like image 226
Stingus Avatar asked Oct 25 '13 11:10

Stingus


1 Answers

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>
like image 74
Timothy Aaron Avatar answered Nov 15 '22 18:11

Timothy Aaron