Edit your template called mail/orders/invoice.tpl and find this:
{if $order_info.shipping}
<b>{$lang.shipping_method}:</b> {$order_info.shipping}<br />
{/if}
Add these lines of code just below it so it now looks like this:
{if $order_info.shipping}
<b>{$lang.shipping_method}:</b> {$order_info.shipping}<br />
{/if}
{if $order_info.status == "C"}
{if $order_info.tracking_number|strlen >0}
<b>{$lang.tracking_number}:</b> <a href="{$http_location}/tracking.php?id={$order_info.tracking_number}">{$order_info.tracking_number}</a><br />
{/if}
{/if}
Now we need to make a new file called tracking.php and place it where your shopping cart is located. Example: If you cart is located at http://www.shopingcart.com/cart/ then you want tracking in the cart folder. Here is the code:
<?php
$tracking=preg_replace("/[^a-z\d]/i", "", $_GET['id']);
$iferr=<<<HTML
<p style="text-align:center;color:red;">ERROR! - Tracking Number $tracking Not Found!</p>
<p style="text-align:center;"><a href="http://{$_SERVER['HTTP_HOST']}">http://{$_SERVER['HTTP_HOST']}</a></p>
HTML;
switch (strlen($tracking)) {
case 11 : header("Location: http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=$tracking"); /* Redirect to DHL */
exit;
break;
case 12 :
case 15 : header("Location: http://www.fedex.com/Tracking?action=track&tracknumbers=$tracking"); /* Redirect to FEDEX */
exit;
break;
case 18 : header("Location: http://wwwapps.ups.com/WebTracking/processRequest?HTMLVersion=5.0&Requester=NES&AgreeToTermsAndConditions=yes&loc=en_US&tracknum=$tracking"); /* Redirect to UPS */
exit;
break;
case 13 :
case 20 :
case 22 : header("Location:http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum=$tracking"); /* Redirect to USPS */
exit;
break;
default : echo $iferr;
}
?>
Let me know if we need to tweek this MOD.