![](/img/trans.png)
[英]How to add new custom field in Customer ‘Account page and in admin area?
[英]Opencart 2 Add custom customer data to admin customer profile page
我有一个新的mysql表,称为co_customer,它存储有关客户的其他唯一内容。 我可以查看所有这些内容,并且正在使用客户注册表。 但是,我现在正在尝试使这些新的自定义字段在管理面板客户个人资料页面上可编辑。 我目前正在对此进行测试,以使其中一个新领域可以工作。 但是,新字段为空白,我在页面顶部收到以下错误
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'] = '';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.