Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Multiple-Carrier Tracking Numbers Mod for your Orders page!

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #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
  #2  
Old 09-11-2005, 08:12 PM
  Dongan's Avatar 
Dongan Dongan is offline
 

X-Wizard
  
Join Date: Jul 2005
Location: www.mercuryminds.com
Posts: 1,531
 

Default

sounds good. Thanx for sharing...
Reply With Quote
  #3  
Old 09-16-2005, 08:52 AM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default

btomasie,

Thanks for posting this mod. This is exactly what we need, as we do a lot of drop shipping as well. I am, however, getting stumped on one very important part of this mod. I'm looking in this version of order.php:

# $Id: order.php,v 1.1.2.2 2005/01/12 07:41:43 svowl Exp $

and I can not find:

Code:
db_query("update $sql_tbl[orders] set tracking='$tracking', notes='$notes' $details where orderid='$orderid'");

This is a short file, so I eyeballed the file and use "find". Nothing. Is order.php the right file to change? TIA
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #4  
Old 09-16-2005, 09:34 AM
 
btomasie btomasie is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 80
 

Default

I just double-checked, and yep, that's the correct spot (at least for 4.0.14). I wouldn't think it'd change greatly in one 0.01 version change.

Here is a larger chunk of the code with an entire section before the spot that we need to change, for you to find this section your a bit easier:

Code:
# # Collect infos about ordered products # require $xcart_dir."/include/history_order.php"; $order = $order_data["order"]; $userinfo = $order_data["userinfo"]; $products = $order_data["products"]; $giftcerts = $order_data["giftcerts"]; $smarty->assign("orderid", $orderid); if ($mode == "status_change") { # # Update order # $details = ", details='".addslashes(text_crypt($details, ($config["Security"]["blowfish_enabled"] == "Y" ? true : false)))."'"; if ($config["Security"]["blowfish_enabled"] == "Y" && !$merchant_password) $details = ""; 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'");

Hope this helps. Let us know.
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
  #5  
Old 09-16-2005, 09:44 AM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default

Hmmm...

this is the entire .php file:

Code:
<?php /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2005 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2005 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: order.php,v 1.1.2.2 2005/01/12 07:41:43 svowl Exp $ # require "./auth.php"; require $xcart_dir."/include/security.php"; require $xcart_dir."/include/categories.php"; if($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; require $xcart_dir."/include/history_order.php"; $smarty->assign("main","history_order"); # Assign the current location line $smarty->assign("location", $location); func_display("customer/home.tpl",$smarty); ?>

I've checked if this is the same for 4.0.14 and 4.0.15 and it is.

Are you referring to order.php in the cart's root folder, or an order.php in a different folder?
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #6  
Old 09-16-2005, 10:00 AM
 
btomasie btomasie is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 80
 

Default

Aha, that's the discrepency!! You are looking at the file insid eyour root xcart folder. Look at my reference at the top again:

(storename)\admin\order.php

Go inside the admin folder, and then modify the order.php page.

You should have it from there!
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
  #7  
Old 09-16-2005, 10:05 AM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default

Thank you Brian,

Now I see, I got stuck in the "Detailed Steps:" section, and didn't referrence back to the "Summary of placed were modifications will be performed: " section. You're so organized, it mystified me.
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #8  
Old 09-16-2005, 10:15 AM
 
btomasie btomasie is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 80
 

Default

No problem!! Trust me, I'm not organized, I just figured I owed it to all the members to walk through all that at such a detailed level, that no one screwed up their site!

Enjoy it!
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
  #9  
Old 12-05-2005, 02:03 AM
  MythNReality's Avatar 
MythNReality MythNReality is offline
 

X-Adept
  
Join Date: Mar 2005
Location: S. Cali
Posts: 403
 

Default

From what I see, it works great with my version...(haven't found problem just yet). Thanks for the great mode.
__________________
_____________
Capture Your Mini-Me Look!

- X-CART Gold (Current Version) V4.6
- Reboot
- CDSEO
Reply With Quote
  #10  
Old 12-09-2005, 10:38 AM
 
hyratech hyratech is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 172
 

Default

I appreciate this MOD.. it's EXCELLENT.. it's a must have..

I would do it if i know how..

The original one has the link in the email.. <I think>

now. it just shows the tracking number. No link.. it'll be so much easier for the customer if they can just click on it and takes them tot the appropriete site for tracking..

Again! Thank you for the MOD... i just thought it'll be nicer if it had that feature.

I implemened the mod... however the email sent to the customers when the order is "complete" the Email is not HTML.. and turned into only text.. and all messed up..

I'm using 4.0.17 is there a difference?

Also,

How would you remove the original "Tracking number" Box? we added 4.. but there was one there already.
__________________
hyratech
X-CART Gold 4.1.10
Hosted - Unix
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:58 PM.

   

 
X-Cart forums © 2001-2020