Jump to content

Adding Column Carrier Column & Filter - BackOffice Orders P1.7.6


surcouf13

Recommended Posts

Hi,

I'm using Prestashop 1.7.6.9 & I try adding a new column in order back office.

I want to add "carrier" column and it will filter by carrier name.

I use AdminOrdersController.php in override / controllers / admin and my new column appear

my code :

<?php

class AdminOrdersController extends AdminOrdersControllerCore
{
    public function __construct()
    {

        parent::__construct();

       
        $this->_select .= ', oc.`id_carrier`,';

        
        $this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'order_carrier` oc ON (a.`id_order` = oc.id_order)';

        
        $carrier_column = array(
            'title' => $this->trans('Carrier', array(), 'Admin.Global'),
            'align' => 'text-center',
            'callback' => 'printCarrierIcon',
            'orderby' => true,
            'search' => false,
        );

        
        $part1 = array_slice($this->fields_list, 0, 2);
        $part2 = array_slice($this->fields_list, 2);
        $part1['id_carrier'] = $carrier_column;
        $this->fields_list = array_merge($part1, $part2);

    }

    
    public function printCarrierIcon($id_order, $tr)
    {
        if (file_exists(_PS_TMP_IMG_DIR_ . 'carrier_mini_' . $tr['id_carrier'] . '_1.jpg')) {
            return '<img src="../img/tmp/carrier_mini_' . $tr['id_carrier'] . '_1.jpg'.'" class="imgm img-thumbnail" />';
        }
        return null;
    }

}

 

Now I have problem to add filter for my column, I try to add filter with carrier name but it's not working

I'm totally lost, if some one can help me

Thanks

Best regards

 

-prestashop_1769.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...