dsjhejw3232 2016-03-16 15:38
浏览 9

Opencart 2将自定义客户数据添加到管理客户配置文件页面

I have a new mysql table I call co_customer that stores additional unique content about a customer. This content I have all viewable and working on the customer registration form. However I am now trying to make these new custom fields editable on the admin panel customer profile page. I am currently just testing this our to get one of the new fields to work. However the new field is blank and I am getting the below error at the top of the page

Notice: Undefined index: cofirstname in  
/home/public_html/admin/controller/customer/customer.php on line 972

I edited the below file 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;
             }
 }

I edited the below file 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'] = '';
    }
  • 写回答

1条回答 默认 最新

  • dsvbtgo639708 2016-03-17 12:08
    关注

    I suggest use the existing feature of OpenCart rather than editing code.

    Login Admin/Customers/Custom Fields, here you can add fields and assign it to customer

    enter image description here

    for detail

    评论

报告相同问题?

悬赏问题

  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入