【发布时间】:2016-03-16 15:38:56
【问题描述】:
我有一个名为 co_customer 的新 mysql 表,它存储有关客户的其他独特内容。我可以查看所有内容并在客户注册表单上工作。但是,我现在正在尝试使这些新的自定义字段在管理面板客户资料页面上可编辑。 我目前正在测试这个我们的新领域之一。但是新字段是空白的,我在页面顶部收到以下错误
Notice: Undefined index: cofirstname in
/home/public_html/admin/controller/customer/customer.php on line 972
我编辑了以下文件 public_html/admin/model/customer/customer.php
public function getCustomer($customer_id)
{
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$customer_id . "'");
return $query->row;
//get coapplicant data
$cocustomersql = $this->db->query("SELECT * FROM " . DB_PREFIX . "co_customer WHERE customer_id = '" . (int)$customer_id . "'");
if ($cocustomersql->num_rows > 0)
{
return $cocustomersql->row;
}
}
我编辑了以下文件 public_html/backoffice/controller/customer/customer.php
if (isset($this->request->post['cofirstname']))
{
$data['cofirstname'] = $this->request->post['cofirstname'];
} elseif (!empty($customer_info)) {
$data['cofirstname'] = $customer_info['cofirstname'];
} else {
$data['cofirstname'] = '';
}
【问题讨论】:
-
我知道 OC2 在管理面板中有一种方法可以通过管理员/客户/自定义字段添加自定义字段,但这会使该字段在我不想要的面向客户的一侧可见。
标签: php mysql opencart2.x