【发布时间】:2020-03-27 16:08:17
【问题描述】:
我想在付款方式下有一个自定义输入字段,以便在下订单之前获取 GST 税详细信息。我正在使用 Journal 3 主题。它有一个单页结帐。
所以,我试过这篇文章:- https://forum.opencart.com/viewtopic.php?t=172521
在 catalog/view/theme/journal3/template/journal3/checkout/payment_method.twig ---添加了这一行
<input name="get_gst" type="text" placeholder="{{ custom_gst }}" class="form-control">
在目录/控制器/结帐/payment_method.php
$this->session->data['comment'] = strip_tags($this->request->post['comment']); //Under this line
$this->session->data['your_field'] = strip_tags($this->request->post['get_gst']); //I added this line
在目录/控制器/checkout/confirm.php
$order_data['comment'] = $this->session->data['comment']; //Under this line
$order_data['get_gst'] = $this->session->data['get_gst']; //I added this line
在目录/模型/结帐/order.php
, comment = '" . $this->db->escape($data['comment']) . "' //after this line
, get_gst = '" . $this->db->escape($data['get_gst']) . "' //I added this line
毕竟得到这个错误...
SyntaxError:JSON.parse:JSON 数据的第 1 行第 1 列出现意外字符 好的
我注意到这个主题是通过 v-model="order_data.comment" 获取其他字段数据(如:评论框),如下所示,而不是像我使用的 name 属性.
<textarea class="form-control" v-model="order_data.comment" placeholder="{{ text_comments }}"></textarea>
所以,我也在我的输入中尝试了这个 v-model="get_gst",但是我得到一个空的结帐页面。
有人知道在哪里出现错误吗?提前谢谢你。
【问题讨论】:
-
任何帮助将不胜感激!
-
另外,我在简单的 opencart 中尝试过,但错误相同:SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
标签: opencart opencart2.x opencart-3 journal