How to get data from Magento Onepage Checkout?

To add a customer comment field to Magento Checkout, I added a text box to the corresponding template file and added a 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 fine using the OnestepCheckout extension, however it does not work with the Magento Onepage Checkout. "GetParam (" cpOrderComment ") is always empty, and now I'm not sure how to get the value of my text field.

Any ideas would be greatly appreciated!

+4
source share
1 answer

This issue has been resolved. Part of the validation check is sent by the save function in the skin / frontend / base / default / js / opcheckout.js file around line 820.

This function does not take into account all the fields in the agreement file. phtml, but only those inside $ ('ol # checkout-agreement') go figure ...

Obviously, the solution is to put the field inside ul # retention conventions or modify opcheckout.js to include all fields from the conventions. phtml.

+4
source

All Articles