【发布时间】:2014-11-15 13:37:59
【问题描述】:
我正在尝试在 opencart 中添加新的输入文本, 我的观点 payment_method.tpl 我添加了
<label><?php echo $text_comments; ?></label>
<textarea name="comment" rows="8" style="width: 98%;"><?php echo $comment; ?></textarea>
<label><?php echo $text_referred; ?></label> // My Code
<input type="text" name="referred" value="<?php echo $referred; ?>" />
在控制器payment_method.tpl我添加了
if (!$json) {
$this->session->data['payment_method'] = $this->session->data['payment_methods'][$this->request->post['payment_method']];
$this->session->data['comment'] = strip_tags($this->request->post['comment']);
$this->session->data['referred'] = $this->request->post['referred']; //My Code
}
和
if (isset($this->session->data['referred'])) {
$this->data['referred'] = $this->session->data['referred']; //Variable
} else {
$this->data['referred'] = '';
}
在我的模型中 Order.php
$this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', referred = '" . $this->db->escape($data['referred']) . "',
我的错误日志显示
2014-09-21 12:57:42 - PHP Notice: Undefined index: referred in /home/dlars/public_html/tempdir/vqmod/vqcache/vq2-catalog_controller_checkout_payment_method.php on line 212
2014-09-21 12:57:42 - PHP Notice: Undefined index: referred in /home/dlars/public_html/tempdir/vqmod/vqcache/vq2-catalog_model_checkout_order.php on line 4
我收集到我视图中的任何内容都没有发布到我的控制器,但是我不确定我可以在哪里定义引用。 我认为使用 OC 在视图中定义的任何内容都已发布到控制器?
请大家帮忙
提前致谢
【问题讨论】: