dongqufi82315 2014-04-19 08:08
浏览 6

Opencart将新字段添加到管理部分的客户视图中

I have added a new field to my database. I also have managed to add necessary codes and functions in catalog section. This new field is related to the customer. The data related to this new field gets added successfully to the database.

This new field belongs to Customer table.

Now, I want to know, when viewing customer's details in the admin section, how this new field should be retrieved from database? I mean which file should be edited for this purpose?

  • 写回答

1条回答 默认 最新

  • duandu8202 2014-04-19 09:46
    关注

    getCustomer($customer_id) and getCustomers($data = array()) are the functions used to get customer data.

    Since they are SELECT * querys your field is being processed automatically.

    Afterwards you need to go in the Controller section in the controller\sale folder and there you have customer.php, custom_field.php and and edit the ones that you need. For example:

    $this->data['customers'][] = array(
                    'customer_id'    => $result['customer_id'],
                    'name'           => $result['name'],
                    'email'          => $result['email'],
                    'customer_group' => $result['customer_group'],
                    'status'         => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')),
                    'approved'       => ($result['approved'] ? $this->language->get('text_yes') : $this->language->get('text_no')),
                    'ip'             => $result['ip'],
                    'date_added'     => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
                    'selected'       => isset($this->request->post['selected']) && in_array($result['customer_id'], $this->request->post['selected']),
                    'action'         => $action
                ); 
    

    add your field in this array (this is from customer.php).

    And finally edit the .tpl files that are called from the view\template\sale folder so they appear where they want them to.

    Hope i was clear enough.

    评论

报告相同问题?

悬赏问题

  • ¥15 echarts动画效果失效的问题。官网下载的例子。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加