Dove99x Posted May 16, 2017 Share Posted May 16, 2017 I'm having trouble adding tracking number to email as it is showing up as blank version 1.6.1.7 . I went into "class/order/OrderHistory.php" and updated the code $topic = $result['osname']; $data = array( '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{order_name}' => $order->getUniqReference() ); to this below, but the when email template is sent out the {shipping_number} is empty. How can I fix this? $topic = $result['osname']; $data = array( '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{shipping_number}' => $order->shipping_number, '{order_name}' => $order->getUniqReference() ); Link to comment Share on other sites More sharing options...
BalzoT Posted May 16, 2017 Share Posted May 16, 2017 Hi, you mean the mail that is received by the user that sends a message through the previous orders page? Link to comment Share on other sites More sharing options...
Dove99x Posted May 16, 2017 Author Share Posted May 16, 2017 (edited) Hi, you mean the mail that is received by the user that sends a message through the previous orders page? If a tracking number is updated in the back office, users usually receive an email updating them. I'd like to add that tracking code to that shipping email: HI {FIRSTNAME} {LASTNAME}, YOUR ORDER HAS BEEN SHIPPED ORDER {ORDER_NAME} - SHIPPED Your order with the reference {order_name} has been shipped. Your tracking number is {shipping_number} Problem is {shipping_number} is blank in the user email - even though in the back office there is a tracking number. Edited May 16, 2017 by Dove99x (see edit history) Link to comment Share on other sites More sharing options...
BalzoT Posted May 16, 2017 Share Posted May 16, 2017 Ok! your logic seems correct. First be sure that you changed the correct email template. There are two possible sources of the mail templates. The first one is on the _root_directory/mails/ the second is _current_theme_/mails be sure you are changing the second one. Also check if the $order->shipping_number is not empty. so I say you try this code $topic = $result['osname']; $data = array( '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{shipping_number}' => $order->shipping_number ? $order->shipping_number : 'NO NUMBER WAS GIVEN', '{order_name}' => $order->getUniqReference() ); Link to comment Share on other sites More sharing options...
Dove99x Posted May 16, 2017 Author Share Posted May 16, 2017 (edited) It looks $order->shipping_number is empty as it resulted in "NO NUMBER WAS GIVEN" for {shipping_number} in emails sent to users. I've updated both email templates in the root as well as the theme. Edited May 16, 2017 by Dove99x (see edit history) Link to comment Share on other sites More sharing options...
BalzoT Posted May 16, 2017 Share Posted May 16, 2017 (edited) I suggest you use something like this $topic = $result['osname']; $tracking_num = Db::getInstance()->getValue( 'SELECT tracking_number FROM '._DB_PREFIX_.'order_carrier ' .'WHERE id_order = '.$this->id_order ); $data = array( '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{shipping_number}' => $tracking_num, '{order_name}' => $order->getUniqReference() ); Edited May 16, 2017 by BalzoT (see edit history) Link to comment Share on other sites More sharing options...
Dove99x Posted May 16, 2017 Author Share Posted May 16, 2017 Your a genius BalzoT! Thank you! Link to comment Share on other sites More sharing options...
todoboho Posted July 7, 2019 Share Posted July 7, 2019 (edited) thanks! Edited July 7, 2019 by todoboho (see edit history) Link to comment Share on other sites More sharing options...
ron441241 Posted August 5, 2020 Share Posted August 5, 2020 I am having the same issue with Prestashop 1.6.20, when customer receives email the tracking number is blank. How do I fix this issue please? Thank you. 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