How to get Post Data from Magento's Onepage Checkout?

白昼怎懂夜的黑 提交于 2019-12-12 12:17:31

问题


in order to add a customers comment field in the Magento Checkout, I added a text field in the appropriate template file and added the comment to the order using an observer like this:

        $comment = strip_tags(Mage::app()->getRequest()->getParam('cpOrderComment'));  

        if(!empty($comment)){  
           $observer->getEvent()->getOrder()->setCustomerNote($_comments);              
        } 

This worked perfectly using the OnestepCheckout extension, however it does not work with Magento's Onepage Checkout. The "getParam('cpOrderComment')" is always empty and now I not sure how to get the value of my text field.

Any ideas would be greatly appreciated!


回答1:


This problem is solved. The review part of the checkout is submited by the save function in skin/frontend/base/default/js/opcheckout.js around line 820.

This function does not take all fields into account from the agreements.phtml, but only the ones inside $('ol#checkout-agreements') - go figure...

The solution is obviously to to put the field inside the ul#checkout-agreements or to change opcheckout.js to include all the fields from the agreements.phtml.



来源:https://stackoverflow.com/questions/7461569/how-to-get-post-data-from-magentos-onepage-checkout

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