Jump to content

[SOLVED] show the name of transporter in the order section


abahou
 Share

Recommended Posts

You will need to override the AdminOrdersController class in order to do this. Try creating a new file, "/override/controllers/admin/AdminOrdersController.php" and paste the following code into it:

 

<?php
class AdminOrdersController extends AdminOrdersControllerCore
{
  public function __construct()
  {
    parent::__construct();

    $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'carrier` crr ON (crr.`id_carrier` = a.`id_carrier`)';
    $this->_select = 'crr.`name` AS `carrier_name`,'.$this->_select;

    $this->fields_list['carrier_name'] = array(
      'title' => $this->l('Carrier '),
      'width' => 100,
      'havingFilter' => true,
    );
  }
}

Reorder the "fields_list" array to position the carrier name in the table.
You might have to delete the class index (/cache/class_index.php) to get the override running.

Edited by jgullstr
As requested by Author, added 'havingFilter' => true, (see edit history)

Share this post


Link to post
Share on other sites

Try replacing
 

$this->fields_list['carrier_name'] = array(
  'title' => $this->l('Carrier '),
  'width' => 100,
  'havingFilter' => true,
);
 

with
 

$pos = 3; //Change this to the position you want
$this->fields_list = array_slice($this->fields_list, 0, $pos, true) +
  array(
    'carrier_name' => array(
    'title' => $this->l('Carrier '),
    'width' => 100,
    'havingFilter' => true,
    )
  ) + array_slice($this->fields_list, $pos, count($this->fields_list)-$pos, true);

I haven't tested this, but if it doesn't work it should give you an idea about what to do.

Edited by jgullstr
As requested by Author, added: 'havingFilter' => true, (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

  • 2 weeks later...

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More