How to Add Tracking Number To Prestashop Email Template

Many assumed the tracking numbers were viewable in the prestashop front office for the customer in their account, but have realized that this is not the case. The "In Transit" e-mail that is sent to the customer upon inputting the tracking number in the BO only provides a link to a website (example for those who use USPS, so the link is as that is where the customer will track their package). This link would only be helpful if the tracking number that I input for individual customers is included in the same e-mail. At the very least, the number should be viewable somewhere in the customers' account, but it is not.

So how can we  Add Tracking Number To Prestashop Email Template ?

1. Don't forget to backup your prestashop file first
2. You need to edit the admin/tabs/AdminOrders.php file, inside is a function called postProcess
3. Find following code. Add the bold code inside it.
$templateVars = array(
    '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
    '{firstname}' => $customer->firstname,
    '{lastname}' => $customer->lastname,
    '{shipping_number}' => $shipping_number,
    '{id_order}' => (int)($order->id)
4. in your mail template for english it is in /mail/en/ named in_transit.html and in_transit.txt, add {shipping_number} where ever you want the tracking number to appear. 

For latest version of prestashop (1.5 and above), you need to find the code in the controllers/admin/AdminOrdersController. Look for the following code
$order->shipping_number)$templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
change it to :
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number)$templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
'{shipping_number}' => $order->shipping_number

There is a module that could make your life easier if you have lots of tracking number to input. This module could import all your tracking number at once. Orders will be updated and your customers will receive an email with the tracking URL of their parcels. Module features :
  1. Compatible from Prestashop 1.1 to 1.6
  2. You can choose the orders status after the import (most of the time “Shipped”)
  3. You can choose the CSV format to adapt the module to your needs: Header lines, column separator, columns numbers
  4. You can choose the identifier of your orders: Order ID, cart ID, invoice number or delivery number
  5. Free and automatic updates of the module
  6. Access personalized support directly from the module page
You could check this awesome module by clicking this link