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'] = '';
}
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
for detail
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.