newbie_prestashop Posted November 8, 2014 Share Posted November 8, 2014 Hi,, How can i add phone no on orders tab back office? Some changes done in adminorderscontroller.php add in query select ad.phone_mobile and LEFT JOIN `'._DB_PREFIX_.'address` ad ON (ad.`id_customer` = a.`id_customer`) like $this->_select = ' 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,ad.phone_mobile'; $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) 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.') LEFT JOIN `'._DB_PREFIX_.'address` ad ON (ad.`id_customer` = a.`id_customer`) '; $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; and 'phone_mobile' => array( 'title' => $this->l('phone'), 'width' => 140, ), its working but there is some orders is repeated in list. Can anyone sugguest solution. Link to comment Share on other sites More sharing options...
bellini13 Posted November 8, 2014 Share Posted November 8, 2014 An order can have 1 or 2 addresses (1 billing and 1 delivery address), and they can either be the same or they can be different. I believe you are seeing multiple orders in the instances where the order has 2 addresses. Therefore you would need to determine which address (billing or delivery) that you want to pull the phone number from. Then you would need to add that to your where clause... So if you want to show the phone from the billing address, it would be something like... WHERE so.id_address_invoice=ad.id Link to comment Share on other sites More sharing options...
Recommended Posts