如何从Magento的一页结帐中获取发布数据? [英] How to get Post Data from Magento's Onepage Checkout?

查看:68
本文介绍了如何从Magento的一页结帐中获取发布数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了在Magento 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);              
        } 

使用OnestepCheckout扩展程序可以很好地工作,但是不适用于Magento的Onepage Checkout. "getParam('cpOrderComment')"始终为空,现在我不确定如何获取文本字段的值.

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.

任何想法将不胜感激!

推荐答案

此问题已解决.结帐的审核部分由保存功能在第820行附近的skin/frontend/base/default/js/opcheckout.js中提交.

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.

此功能不会考虑所有来自Conventions.phtml的字段,而是仅考虑$('ol#checkout-agreements')内部的字段-数字...

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

显然,解决方案是将字段放入ul#checkout-agreements内,或更改opcheckout.js使其包含Agreements.phtml中的所有字段.

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.

这篇关于如何从Magento的一页结帐中获取发布数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆