ICT-LabS Posted March 4, 2016 Share Posted March 4, 2016 Hello comunity, this is my first topic. I am using Prestashop 1.6 and I need to get the company name of delivery address in order history view (in one of the column). I can easily get the address id but how to get the name of company? i search in controller and class to add the variable company, somethingh like: $address = new Adress($order.id_address_delivery) $company=$address->company but i am lost. Can anyone help me or suggest for a solution? Thank you Link to comment Share on other sites More sharing options...
REGE Posted March 9, 2016 Share Posted March 9, 2016 (edited) Hello, First off all you must override controllers/front/HistoryController.php. Search initContent() method: /** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); if ($orders = Order::getCustomerOrders($this->context->customer->id)) foreach ($orders as &$order) { $myOrder = new Order((int)$order['id_order']); if (Validate::isLoadedObject($myOrder)) $order['virtual'] = $myOrder->isVirtual(false); } $this->context->smarty->assign(array( 'orders' => $orders, 'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'), 'reorderingAllowed' => !(int)Configuration::get('PS_DISALLOW_HISTORY_REORDERING'), 'slowValidation' => Tools::isSubmit('slowvalidation') )); $this->setTemplate(_PS_THEME_DIR_.'history.tpl'); } and replace it by: /** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); if ($orders = Order::getCustomerOrders($this->context->customer->id)) foreach ($orders as &$order) { $myOrder = new Order((int)$order['id_order']); if (Validate::isLoadedObject($myOrder)) $order['virtual'] = $myOrder->isVirtual(false); $delivery_address = new Address($order['id_address_delivery']); $order['company_delivery'] = $delivery_address->company; } $this->context->smarty->assign(array( 'orders' => $orders, 'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'), 'reorderingAllowed' => !(int)Configuration::get('PS_DISALLOW_HISTORY_REORDERING'), 'slowValidation' => Tools::isSubmit('slowvalidation') )); $this->setTemplate(_PS_THEME_DIR_.'history.tpl'); } Now you've got {$order.company_delivery} variable, to use in your history.tpl file. Edited March 9, 2016 by REGE (see edit history) Link to comment Share on other sites More sharing options...
ICT-LabS Posted March 11, 2016 Author Share Posted March 11, 2016 Thanks REGE, i use your code and everythings works fine. Link to comment Share on other sites More sharing options...
Butigon Posted January 3, 2021 Share Posted January 3, 2021 Hello friends! I need the order history table, like the invoice, to also show the delivery slip (link to download its pdf), does anyone have the trick? thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now