我正在尝试向结帐页面添加自定义字段。我遇到的问题是"未定义索引:my_field"在第6步(确认订单)。我使用的是2.1.0.1版本
我已将一个textarea添加到payment_method.tpl
<textarea name="my_field"></textarea>
我还将这些行添加到付款方式控制器(payment_method.php)
if (isset($this->request->post['my_field'])) {
$data['my_field'] = $this->request->post['my_field'];
} else {
$data['my_field'] = '';
}
并将此添加到我在控制器目录
下的confirm.php中$order_data['my_field'] = $this->request->post['my_field'];
我将此行添加到order.php以更新数据库
$this->db->escape($data['my_field']);
答案 0 :(得分:0)
我刚刚想通了 改变这个
$order_data['my_field'] = $this->request->post['my_field'];
到
$order_data['my_field'] = $this->session->data['my_field'];
我还将此行添加到payment_method.php
$this->session->data['my_field'] = strip_tags($this->request->post['my_field']);
这一行之后:
$this->session->data['comment'] = strip_tags($this->request->post['comment']);