开发者

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

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 appreci开发者_StackOverflowated!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜