Jump to content

Adding "Country" column to the Admin Tab "Orders"


fishordog

Recommended Posts

Was trying to find any info on forums on how to add column to Orders Tab in the BO, had no luck so far. I want to have an extra column which will show Country from the shipping address of the customer.

Thank you

 

Edit:

 

I have added a column "Country" but it doesnt show country of the order

 

$statesArray = array();

$states = OrderState::getOrderStates((int)($cookie->id_lang));

foreach ($states AS $state)

$statesArray[$state['id_order_state']] = $state['name'];

$this->fieldsDisplay = array(

'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),

'new' => array('title' => $this->l('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'filter_key' => 'new', 'tmpTableFilter' => true, 'icon' => array(0 => 'blank.gif', 1 => 'news-new.gif'), 'orderby' => false),

'customer' => array('title' => $this->l('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' => true),

'total_paid' => array('title' => $this->l('Total'), 'width' => 70, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'price' => true, 'currency' => true),

'payment' => array('title' => $this->l('Payment'), 'width' => 100),

'osname' => array('title' => $this->l('Status'), 'widthColumn' => 230, 'type' => 'select', 'select' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 100),

'country' => array('title' => $this->l('Country'), 'width' => 100),

'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'),

'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false));

parent::__construct();

Link to comment
Share on other sites

<p>I did, but maybe i made some mistakes</p>

<p> </p>

<p> </p>

<p class="posted_info" style="color: rgb(104, 115, 127); font-size: 12px; line-height: 18px; font-family: Arial, Helvetica, sans-serif; padding: 0px 0px 10px; ">Today, 06:14 PM</p>

<div class="post" style="margin: 0px; padding: 0px; line-height: 1.6; font-size: 12px; color: rgb(104, 115, 127); font-family: Arial, Helvetica, sans-serif; ">I have changed and country column is still empty<br />

<br />

a.id_order AS id_pdf,<br />

ad.`country` AS `customer`,<br />

osl.`name` AS `osname`,<br />

os.`color`,<br />

IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new,<br />

(SELECT COUNT(od.`id_order`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = a.`id_order` GROUP BY `id_order`) AS product_number';<br />

$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)<br />

LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`)<br />

LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`)<br />

LEFT JOIN `'._DB_PREFIX_.'address` ad ON (a.`id_address_delivery` = ad.`id_address`)<br />

LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)($cookie->id_lang).')';<br />

$this->_where = 'AND oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = a.`id_order` GROUP BY moh.`id_order`)';</div>

 

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...