Opencart结帐未通过自定义字段 [英] Opencart checkout not passing through custom field
问题描述
我正在尝试向结帐添加2个自定义字段(其中1个用于礼品券,一个用于让用户选择发送日期).我设法使礼物记录字段正常运行,但是在日期字段方面遇到了麻烦.
I'm trying to add 2 custom fields to the checkout (one for a gift note, one to let users choose the dispatch date). I managed to get the gift note field up and running fine but I'm having trouble with the date field.
我正在使用标准文本字段(输入类型为文本"),目的是将jQuery UI用于日期选择器,但是未传递文本字段的值.如果我从输入更改为文本区域,则数据确实会通过.我正在尝试在Opencart 1.5.4的结帐的付款方式"阶段将它们都添加.
I'm using a standard text field (input type="text") with the intention of using jQuery UI for the date picker, but the value of the text field isn't being passed through. If I change from an input to a textarea the data does get passed through. I'm trying to add them both in the 'Payment Method' stage of the checkout on Opencart 1.5.4.
我是Opencart的新手(昨天,当我被要求添加这些字段时才开始查看它),但了解MVC + L模式,并且正如我所说的,设法使一个字段工作并传递到数据库中.我没有使用vQmod.
I'm new to Opencart (started looking at it yesterday when I was asked to add these fields) but understand the MVC+L pattern and, as I say, managed to get one field working and passed into the database. I'm not using vQmod.
输入字段中的数据不会传递到controller/payment_method.php中的$ this-> request-> post
The data from the input field just isn't getting passed into $this->request->post in controller/payment_method.php
对我来说这似乎是个错误,这只是Opencart的怪癖吗?如果没有解决方案,我可以在技术上使用textarea,但是解决该问题的方法有点肮脏
This seems like a bug to me, is it just a quirk of Opencart? I could technically use a textarea if there isn't a solution but that feels a bit of a dirty way around the problem
推荐答案
我在我的情况下找到了解决方案,这是我做的以防将来对任何人有帮助的情况.
I found the solution in my case, here's what I did in case it helps anyone in the future.
我发现所有用于通过其发布数据的AJAX都位于
I found that all the AJAX for posting data through is in
视图/主题/主题名称/template/checkout/checkout.tpl
view/theme/THEME-NAME/template/checkout/checkout.tpl
我搜索了"post"的实例,检查并检查了它们与哪个部分相关.就我而言(在payment_method部分内添加字段),数据被传递到的URL是
I searched for instances of 'post', checked and checked which section they were relevant to. In my case (adding fields inside the payment_method section), the URL the data was being passed to was
index.php?route = checkout/payment_method/validate
,然后将额外字段的ID添加到AJAX调用的data属性中.
and just added the id's of the extra fields into the data attribute of the AJAX call.
希望这对其他人有用
这篇关于Opencart结帐未通过自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!