How to append filed to orders list

1930s-style-cordless-retro-phone

Let’s do a little trick on our prestashop installation to the list of orders from our backoffice appear it in print the customer´s phone number.

this trick allow us to have faster customer information access, the number of contact is a really important thing to arrange deliveries and inform customers about orders.

We started


controllers/admin/AdminOrdersController.php

We located this piece of code and we add color lines


$this->_select = '
                CONCAT(addr.phone, addr.phone_mobile) AS `phone`,
		a.id_currency,
		a.id_order AS id_pdf,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		osl.`name` AS `osname`,
		os.`color`,
		IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new';

		$this->_join = '
                LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order` = a.`id_order`)
		LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
                LEFT JOIN `'._DB_PREFIX_.'address` addr ON (a.`id_address_delivery` = addr.`id_address`)
		LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
		LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';
		$this->_orderBy = 'id_order';
		$this->_orderWay = 'DESC';

		$this->fields_list = array(
		'id_order' => array(
			'title' => $this->l('ID'),
			'align' => 'center',
			'width' => 25
		),
		'reference' => array(
			'title' => $this->l('Reference'),
			'align' => 'center',
			'width' => 65
		),
		'new' => array(
			'title' => $this->l('New'),
			'width' => 25,
			'align' => 'center',
			'type' => 'bool',
			'tmpTableFilter' => true,
			'icon' => array(
				0 => 'blank.gif',
				1 => array(
					'src' => 'note.png',
					'alt' => $this->l('First customer order'),
				)
			),
			'orderby' => false
		),
		'customer' => array(
			'title' => $this->l('Customer'),
			'havingFilter' => true,
		),
	    'phone' => array(
        'title' => $this->l('Phone')
       ),

 

and this is the result..

How to append filed to orders list

 

Posted on 16/02/2014 in Prestashop

Share the Story

About the Author

Responses (2)

  1. Yaniz
    19/02/2014 at 6:39 pm · Responder

    Awesome tip.

    Thanks

  2. Phil
    21/02/2014 at 6:01 am · Responder

    Works like a charm. Thanks

Leave a reply

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Back to Top