View Single Post
  #1  
Old 09-11-2005, 11:30 AM
 
btomasie btomasie is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 80
 

Default Multiple-Carrier Tracking Numbers Mod for your Orders page!

Hi all,
I am just putting the finishing touches on a very large website I have been doing with X-Cart. One thing we will have a lot of with our orders, is almost everything is drop-shipped on our behalf and a lot of times, that may mean multiple carriers are used (i.e UPS, FedEx, USPS, etc.) I could not find on the forum, anyone that accommodated this in a very thorough way. So I took a shot at it, and am VERY pleased with my modification. I have used a LOT of modifications from others on this forum, and so here is my small contribution back to the community....

What this modification does:
- gives your X-Cart Admin the ability to put multiple tracking numbers into the Orders Management order details. Instead of just one generic tracking number textbox, you will now have 4 additional areas to input the tracking number(s) into carrier-specific textareas.

- your customer now will see in their "order processed" (if you punch tracking numbers in during that stage of the order) and "order completed" email, a detailed list of tracking numbers by carrier for their order.


My disclaimers:
- This modification and the following steps described was done to X-Cart 4.0.14. I do not know if all the code is the same in prior versions or revisions.
- you DO have to modify one database table with this modification. If this is something you do not feel comfortable with, you should probably pass on this then. It is a very easy update though... trust me, I am not database expert by any means!! If there's any DBA's or database experts that could create a script, that may be the best bet. The way I did it, was within phpMyAdmin (my service provider gives us an account) and it was so easy to add them.


Summary of placed were modifications will be performed:

- database table modified:
(database name)_orders

- files modified:
(storename)\admin\order.php
(storename)\skin1\main\history_order.tpl
(storename)\skin1\mail\html\order_customer_process ed.tpl
(storename)\skin1\mail\html\order_customer_complet e.tpl
(storename)\skin1\mail\order_customer_processed.tp l
(storename)\skin1\mail\order_customer_complete.tpl



Detailed Steps:

1.) you need to alter one database table to get the new tracking numbers stored. *** MAKE SURE TO BACKUP YOUR DATABASE PRIOR TO ALTERING TABLE ***
There's many different ways to alter your database table to add the 4 new columns that we need. You need to go into the "(database name)_orders" table, and right after the "tracking" column, added 4 new fields:
tracking_ups VARCHAR(64)
tracking_fedex VARCHAR(64)
tracking_usps VARCHAR(64)
tracking_other VARCHAR(64)


2.) in Admin --> Languages, add the following new Label fields (NOTE: for "Values", what you type into here is what you will see in the Orders Management order details AND what the customer sees in their email):
lbl_tracking_number_ups
lbl_tracking_number_fedex
lbl_tracking_number_usps
lbl_tracking_number_other


3.) in order.php, locate this piece of code:
Code:
db_query("update $sql_tbl[orders] set tracking='$tracking', notes='$notes' $details where orderid='$orderid'");

and replace it with:
Code:
db_query("update $sql_tbl[orders] set tracking='$tracking', tracking_ups='$tracking_ups', tracking_fedex='$tracking_fedex', tracking_usps='$tracking_usps', tracking_other='$tracking_other', notes='$notes' $details where orderid='$orderid'");


4.) in history_order.tpl, locate this piece of code:
Code:
{$lng.lbl_tracking_number}: <INPUT type="text" name="tracking" value="{$order.tracking}"{if $usertype eq 'C'} readonly{/if}> {if $usertype eq "A" or ($usertype eq "P" and $active_modules.Simple_Mode)}

replace with:
Code:
{* added new code 9/11/05 to allow Admin to input multiple carrier tracking numbers in *} {* also changed the textbox to be a text area in case we have multiple tracking numbers from same carrier *} {* NOTE: only have about 62 useable characters in the DB for each field and multiple tracking numbers in the same "textarea" box just string together *} {$lng.lbl_tracking_number}: {* this one line below is the original way the textbox showed up in Admin *} {* <INPUT type="text" name="tracking" value="{$order.tracking}"{if $usertype eq 'C'} readonly{/if}> *} <textarea name=tracking cols=60 rows=5>{$order.tracking}</textarea> {if $usertype eq "A" or ($usertype eq "P" and $active_modules.Simple_Mode)} {$lng.lbl_tracking_number_ups}: <textarea name=tracking_ups cols=60 rows=5>{$order.tracking_ups}</textarea> {$lng.lbl_tracking_number_fedex}: <textarea name=tracking_fedex cols=60 rows=5>{$order.tracking_fedex}</textarea> {$lng.lbl_tracking_number_usps}: <textarea name=tracking_usps cols=60 rows=5>{$order.tracking_usps}</textarea> {$lng.lbl_tracking_number_other}: <textarea name=tracking_other cols=60 rows=5>{$order.tracking_other}</textarea> {* end of new code for all the specific carrier tracking number fields *}


You will see that when adding all these, I also I switched them to be textarea boxes and if you by chance have multiple tracking numbers but with the same carrier, you can place each one on a new line within the textarea. When it places these in the customer's email, a space will be put inbetween them. I found that placing a semi-colon after each helps (visually) in the email for the customer (because more tracking numbers like UPS or Priority Mail typically have spaces in them).



5.) in (storename)\skin1\mail\html\... the following is done in both the order_customer_processed.tpl and order_customer_complete.tpl files:

find:
Code:
{if $order.tracking} <TR> <TD>{$lng.lbl_tracking_number}:</TD> <TD width="10"></TD> <TD><TT>{$order.tracking}</TT></TD> </TR> {/if}

and add directly underneath it:
Code:
{* added new code 9/11/05 to accommodate all the specific carrier tracking number fields *} {if $order.tracking_ups} <TR> <TD>{$lng.lbl_tracking_number_ups}:</TD> <TD width="10"></TD> <TD><TT>{$order.tracking_ups}</TT></TD> </TR> {/if} {if $order.tracking_fedex} <TR> <TD>{$lng.lbl_tracking_number_fedex}:</TD> <TD width="10"></TD> <TD><TT>{$order.tracking_fedex}</TT></TD> </TR> {/if} {if $order.tracking_usps} <TR> <TD>{$lng.lbl_tracking_number_usps}:</TD> <TD width="10"></TD> <TD><TT>{$order.tracking_usps}</TT></TD> </TR> {/if} {if $order.tracking_other} <TR> <TD>{$lng.lbl_tracking_number_other}:</TD> <TD width="10"></TD> <TD><TT>{$order.tracking_other}</TT></TD> </TR> {/if} {* end of new code for all the specific carrier tracking number fields *}


6.) in (storename)\skin1\mail\... the following is done in both the order_customer_processed.tpl and order_customer_complete.tpl files:

find:
Code:
{if $order.tracking} {$lng.lbl_tracking_number|truncate:$max_truncate:"...":true|cat:":"|string_format:$max_space}{$order.tracking} {/if}

and add directly underneath it:
Code:
{* added new code 9/11/05 to accommodate all the specific carrier tracking number fields *} {if $order.tracking_ups} {$lng.lbl_tracking_number_ups|truncate:$max_truncate:"...":true|cat:":"|string_format:$max_space}{$order.tracking_ups} {/if} {if $order.tracking_fedex} {$lng.lbl_tracking_number_fedex|truncate:$max_truncate:"...":true|cat:":"|string_format:$max_space}{$order.tracking_fedex} {/if} {if $order.tracking_usps} {$lng.lbl_tracking_number_usps|truncate:$max_truncate:"...":true|cat:":"|string_format:$max_space}{$order.tracking_usps} {/if} {if $order.tracking_other} {$lng.lbl_tracking_number_other|truncate:$max_truncate:"...":true|cat:":"|string_format:$max_space}{$order.tracking_other} {/if} {* end of new code for all the specific carrier tracking number fields *}



ENJOY!!!
Brian
__________________
X-Cart Gold v4.0.18 [unix]
- Easy Checkout module
- ezUpsell module
- CDSEO module

X-Cart Gold v4.1.11 [unix]
***38,000+ active products!
- CDSEO module
- Address Book module
- Reorder module
- Smart Search module

X-Cart Gold v4.4.2 [unix]
- in development now!
Reply With Quote