【问题标题】:Opencart 2 Add custom customer data to admin customer profile pageOpencart 2 将自定义客户数据添加到管理客户资料页面
【发布时间】: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


【解决方案1】:

我建议使用 OpenCart 的现有功能而不是编辑代码。

登录Admin/Customers/Custom Fields,在这里您可以添加字段并将其分配给客户

detail

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-02
    相关资源
    最近更新 更多