Magento onepage checkout saveOrder 302 redirect

送分小仙女□ 提交于 2019-12-31 13:50:40

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/19588485/magento-onepage-checkout-saveorder-302-redirect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!