Jump to content

[GUIDE] Adding tracking number to email templates


johnchristy

Recommended Posts

Hi Friends,

So finally I managed to add tracking number to email template & and I'm going to share that method.

My Prestashop version - 1.6.1.23

1) Open - ~/classes/order/OrderHistory.php
2) Go to line 423
3) Change this code : 
 

           $topic = $result['osname'];
           $data = array(
                '{lastname}' => $result['lastname'],
                '{firstname}' => $result['firstname'],
                '{id_order}' => (int)$this->id_order,
                '{order_name}' => $order->getUniqReference()
            );

to :
 

            $topic = $result['osname'];
            $traking_number = $order->shipping_number;
            if ($traking_number =='') {
                $traking_number ='TRACKING_NUMBER_ID'.(int)$this->id_order;
            }
            $data = array(
                '{lastname}' => $result['lastname'],
                '{firstname}' => $result['firstname'],
                '{id_order}' => (int)$this->id_order,
                '{order_name}' => $order->getUniqReference(),
                '{tracking_number}' => $traking_number
            );


Screenshot - https://www.dropbox.com/s/4wyxyb0ec2b8lb3/2019-03-05_23-03-26.png?dl=0

4) Edit your email template - i.e. ~/mails/en/payment.html
5) Add this code : {tracking_number} 

i.e - 

Your trackign number <strong><span style="color:#333">{tracking_number}</span></strong></span>

6) Enjoy!

Final output - Screenshots :

https://www.dropbox.com/s/fubunumuppdgwnr/2019-03-05_23-07-24.png?dl=0
https://www.dropbox.com/s/liigd027iajxcri/2019-03-05_23-08-28.png?dl=0

NOTE : You must update your tracking number before you send this email notification. If not, {tracking_code} variable will be replaced with a string like "TRACKING_NUMBER_ID5"

Cheers :)

  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...
  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...