Edit Prestashop current orders view

后端 未结 2 425
我在风中等你
我在风中等你 2021-01-16 16:34

I\'m using Prestashop 1.6.0.9.

I wish to edit the raw HTML for this part.

\"enter

相关标签:
2条回答
  • 2021-01-16 16:51

    The filters for BO orders are created by controllers\admin\AdminOrdersController.php.

    In order to preserve prestashop core code it's indicated you create an override for this controller, where you'll need to join the table that you need (if not already joined), specify where in your table is the field you want to use for filter and also the field itself. Have a closer look at the constructor function of AdminOrdersController to better understand how to do this.

    For example if you want to add the carrier name as a filter, create override\controllers\admin\AdminOrdersController.php file and add the following code:

    <?php
    
    class AdminOrdersController extends AdminOrdersControllerCore {
        public function __construct() {
            parent::__construct();
            $this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'carrier` cr ON (cr.`id_carrier` = a.`id_carrier`)';
            $this->_select .= ', cr.name as carrier';
            $this->fields_list['carrier'] = array(
                'title' => $this->l('Carrier'),
                'align' => 'text-center'
            );
        }
    }
    
    0 讨论(0)
  • 2021-01-16 17:03

    If you would like column with carrier add this (behind: "$this->_join = '"):

        LEFT JOIN '._DB_PREFIX_.'carrier ca ON (ca.id_carrier = a.id_carrier) 
    

    and to field list (behind "$this->fields_list = array(") add this:

    'carrier' => array(
                'title' => $this->l('Carrier'),
                'align' => 'text-center',            
                'filter_key' => 'ca!name'
       ),
    
    0 讨论(0)
提交回复
热议问题