View Single Post
  #18  
Old 09-25-2008, 04:00 AM
 
floyd_2 floyd_2 is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 69
 

Default Re: Ability to select shipping carrier for tracking numbers

I wasn't keen to add any more tables to my database or make too many mods to my X-cart installation for fear of difficulat upgrades in the future. I was keen to get a Track It button embedded in my Order Completion email, and implemented a slight modification of MoonDog's method.

In MoonDog's method, it looks to rely on extra database fields that relate each order to the shipping method used. As I use two different trackable shipping companies, I was keen to have the Order Completion email offer just one Track It! button that was already coded to go to the correct carrier's tracking web page. Additionally, I wanted the text in the Order Completion email to still refer to the specific carrier that the customer selected (per MoonDog's original method).

Each of my carriers uses a different prefix for their consignment numbers, so I just stripped out the first two characters of the consignment number to differentiate between the two companies. Any order with a con number starting with "EC" belongs to TNT, and any starting with "13" belongs to Couriers Please. Here's my version of MoonDog's Order Completion email that requires no DB mods etc:

Code:
{* $Id: order_customer_complete.tpl,v 1.10 2006/03/31 05:51:43 svowl Exp $ *} {config_load file="$skin_config"} {include file="mail/html/mail_header.tpl"} <p />{$lng.eml_dear|substitute:"customer":"`$customer.title` `$customer.firstname` `$customer.lastname`"}, <p />{$lng.eml_order_complete} <br> This is confirmation that the products you ordered have been shipped to you! <br> Shipping usually takes 3-5 days depending on your location. <br> {if $order.tracking} {assign var="postal_carrier" value=$order.tracking|truncate:2:"":true} {if $postal_carrier eq "EC"} {assign var="postal_carrier_name" value="TNT Road Express"} {elseif $postal_carrier eq "13"} {assign var="postal_carrier_name" value="Couriers Please"} {/if} Your {$postal_carrier_name} tracking number is {$order.tracking} <br> Please allow up to 24 hours for the {$postal_carrier_name} tracking system to update this information. {/if} <hr size="1" noshade="noshade" /> <p /> <table cellpadding="2" cellspacing="1" width="100%"> <tr> <td width="20%"><b>{$lng.lbl_order_id}:</b></td> <td width="10">&nbsp;</td> <td width="80%"><tt>#{$order.orderid}</tt></td> </tr> <tr> <td><b>{$lng.lbl_order_date}:</b></td> <td width="10">&nbsp;</td> <td><tt>{$order.date|date_format:$config.Appearance.datetime_format}</tt></td> </tr> {if $order.tracking} <tr> <td><b>{$lng.lbl_tracking_number}:</b></td> <td width="10">&nbsp;</td> <td><tt>{$order.tracking}</tt></td> <tr> <td><b>Track your order:</b></td> <td width="10">&nbsp;</td> {assign var="postal_service" value=$order.tracking|truncate:2:"":true} <td><tt> {if $postal_service eq "EC"} {include file="modules/Order_Tracking/tnt.tpl"} {elseif $postal_service eq "13"} {include file="modules/Order_Tracking/couriers_please.tpl"} {else $order.tracking} {/if} {/if} </tt></td></tr> <tr> <td colspan="3">{include file="mail/html/order_data.tpl"}</td> </tr> </table> {include file="mail/html/signature.tpl"}

Please overlook the slight duplication of code. It works well thanks to MoonDog's hard work and my slight mods. If you're worried about having to do too many changes to your X-Cart installation to associate your trackable carrier to your orders, this is a way around it (so long as your carriers use different Con note numbering systems).

Dean
__________________
X-Cart Gold v4.1.8
Reply With Quote