如何在 Prestashop 1.6 后台的订单列表中添加公司的新列?
How can I add on Orders list in the back office of the Prestahop 1.6 a new column for Company?
我正在使用 1.6.1.7 Prestashop 版本的网站,我想在订单页面上的客户和总计列之间显示客户公司的新列。如果可能的话,我更喜欢覆盖必要的文件。
Screenshot example
有人可以帮我做吗?非常感谢!
如果您在 PrestaShop 中启用 B2B 选项,公司将显示在订单列表中而不会被覆盖。
无论如何,这是通过覆盖其 class 在现有控制器中添加列的方法。
<?php
class AdminOrdersController extends AdminOrdersControllerCore
{
public function __construct()
{
parent::__construct();
// add the field to the SQL query
$this->_select .= ', c.company as company';
// field to insert
$insert = array(
'company' => array(
'title' => $this->l('Company'),
'filter_key' => 'c!company',
)
);
// splice the fields list
$end = array_splice($this->fields_list, array_search("customer", array_keys($this->fields_list)));
// insert the new field
$this->fields_list = array_merge($this->fields_list, $insert, $end);
}
}
我正在使用 1.6.1.7 Prestashop 版本的网站,我想在订单页面上的客户和总计列之间显示客户公司的新列。如果可能的话,我更喜欢覆盖必要的文件。
Screenshot example
有人可以帮我做吗?非常感谢!
如果您在 PrestaShop 中启用 B2B 选项,公司将显示在订单列表中而不会被覆盖。
无论如何,这是通过覆盖其 class 在现有控制器中添加列的方法。
<?php
class AdminOrdersController extends AdminOrdersControllerCore
{
public function __construct()
{
parent::__construct();
// add the field to the SQL query
$this->_select .= ', c.company as company';
// field to insert
$insert = array(
'company' => array(
'title' => $this->l('Company'),
'filter_key' => 'c!company',
)
);
// splice the fields list
$end = array_splice($this->fields_list, array_search("customer", array_keys($this->fields_list)));
// insert the new field
$this->fields_list = array_merge($this->fields_list, $insert, $end);
}
}