Greu Posted February 2, 2015 Share Posted February 2, 2015 It can be very useful to have the invoice mentionning order status, especially if an order was cancelled or reimbursed. I'm trying to have an "Order Status" displayed in the Order Information Section below the carrier details (Invoice.tpl) Adding to HTMLTemplateInvoice.php : public function getCurrentStateFull($id_lang) { return Db::getInstance()->getRow(' SELECT os.`id_order_state`, os.`name` FROM `'._DB_PREFIX_.'order_state_lang` os LEFT JOIN `'._DB_PREFIX_.'orders` osl ON (osl.`current_state` = os.`id_order_state`) WHERE osl.`id_lang` = '.(int)$id_lang.' AND os.`id_order_state` = '.(int)$this->current_state); } should make this information available for the invoice, then adding to Invoice.tlp : <tr> <td style="width: 50%"> <b>{l s='Order Status' pdf='true'}</b> </td> <td style="width: 50%"> {$current_state} </td> </tr> should display it in the invoice. There is a mistake somewhere though because nothing is displayed but the title : Order Status. I'm not sure if something is missing in the code, if the place of the code is wrong, or if the procedure itself needs more ellaboration (override etc.) I'd appreciate any expert help - Thanks ! Link to comment Share on other sites More sharing options...
tuk66 Posted February 2, 2015 Share Posted February 2, 2015 Try {$order->current_state} Link to comment Share on other sites More sharing options...
Greu Posted February 3, 2015 Author Share Posted February 3, 2015 thank you much, it improves the situation : some digits are displayed - they correspond to the current_state number indeed it means my logical sequence in HTMLTemplateInvoice.php is wrong : I want to display the name of the order status instead how should the code be modified ? Link to comment Share on other sites More sharing options...
Greu Posted February 5, 2015 Author Share Posted February 5, 2015 in fact, the procedure I mentionned earlier for HTMLTemplateInvoice.php is useless : we get exactly the same result with or without it through {$order->current_state} in Invoice.tlp my question is : how to display the value of "name" (the order status name stored in the table "order_state_lang" not available by requesting $order->name) instead of "current_state" (the order status number code stored in the table "orders" and directly available by requesting $order->current_state) considering that: "name" table1 is linked to "current state" table2 via "id_order_state" table1 = "current_state" table2 AND that only "current_state" is linked to the order id (meaning that we need this logical chain between the 2 tables to link "name" to the order id) getting this is not straightforward and my technical knowledge is not allowing me to find the solution despite having brainstormed a few days on it can anyone help me with this issue please ? I'm sure it's not at all a difficult issue for anyone with programming skills - for someone with very basic programming skills, thinking outside the box is unobvious thanks for taking the rescue challenge ! 1 Link to comment Share on other sites More sharing options...
mouse1 Posted June 28, 2016 Share Posted June 28, 2016 Hi Greu, have you solved the problem? I am working on this as well, but can't find the right source. Thank you. Link to comment Share on other sites More sharing options...
mouse1 Posted July 2, 2016 Share Posted July 2, 2016 Hi taydox, thank you very much for your reply. As said in previous posts, {$order->current_state} only displays the ID number of the status, not the name, e.g. instead of "Order canceled", you get "7". Link to comment Share on other sites More sharing options...
tuk66 Posted July 2, 2016 Share Posted July 2, 2016 Try to use OrderStatus::getOrderStates($id_lang). This method returns an array of all states and you can filter out one. Link to comment Share on other sites More sharing options...
mouse1 Posted July 2, 2016 Share Posted July 2, 2016 Try to use OrderStatus::getOrderStates($id_lang). This method returns an array of all states and you can filter out one. Thank you, tuk66. When I replace {$order->current_state} with {OrderStatus::getOrderStates($id_lang)}, PDF won't load at all. I guess I am doing something wrong. Link to comment Share on other sites More sharing options...
rocky Posted July 4, 2016 Share Posted July 4, 2016 It should be {OrderState::getOrderStates($id_lang)} Link to comment Share on other sites More sharing options...
tuk66 Posted July 4, 2016 Share Posted July 4, 2016 Oh, it was just the mention of useful method, no exact instructions. Link to comment Share on other sites More sharing options...
Boutique da Tereza Posted August 3, 2020 Share Posted August 3, 2020 Hi, have you solved the problem? I am working on this as well, but can't find the right source. Thank you Link to comment Share on other sites More sharing options...
Kaper Posted October 13, 2021 Share Posted October 13, 2021 Not the best solution, but you can use conditions to "translate" current status name. Example, {if $order->current_state == 22} YOUR STATUS NAME HERE {/if} 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