View Single Post
  #14  
Old 07-23-2007, 12:21 AM
 
pavant pavant is offline
 

Advanced Member
  
Join Date: Oct 2004
Location: Chicago, Illinois
Posts: 84
 

Default Re: Ability to select shipping carrier for tracking numbers

I really like this mod and I changed it to work with my 4.1.8 xcart. Here is what I have:
First we need to create a new column in the database xcart_orders. The easiest way to do this is to go to 'Patch/Upgrade' under 'Administration' in your xcart admin. Copy the following in your SQL query(ies): box and click on apply.

Quote:
ALTER TABLE xcart_orders
ADD shipping_vendor char(5) NOT NULL default '' AFTER shippingid;

Step 2: In admin/order.php, replace this code:
Quote:

#
# Update order
#
$query_data = array (
"tracking" => $tracking,
"customer_notes" => $customer_notes,
"notes" => $notes
);
With this code:

Quote:

#
# Update order
#
$query_data = array (
"tracking" => $tracking,
"shipping_vendor" => $shipping_vendor,
"customer_notes" => $customer_notes,
"notes" => $notes
);

Step 3: Then you will need to add a template under skin1/main called 'order_shipping_vendor.tpl' containing the following code:
Quote:


{* $Id: order_shipping_vendor.tpl,v 1.4 2004/05/28 12:21:03 max Exp $ *}
<SELECT name="shipping_vendor">
{if $status eq ""}<OPTION value="">Select one</OPTION>
{/if}
<OPTION value="FedEx"{if $status eq "FedEx"} selected{/if}>FedEx</OPTION>
<OPTION value="UPS"{if $status eq "UPS"} selected{/if}>UPS</OPTION>
<OPTION value="USPS"{if $status eq "USPS"} selected{/if}>USPS</OPTION>
<OPTION value="DHL"{if $status eq "DHL"} selected{/if}>DHL</OPTION>
</SELECT>

Step 4: Finally you will need to edit template file skin1/main/history_order.tpl.
Find:

Quote:

{if $usertype eq "A"}
{if $active_modules.Google_Checkout ne '' and $order.extra.goid ne ''}
{include file="main/order_status.tpl" status=$order.status mode="select" name="status" extra="disabled='disabled'"}
<br />
{$lng.txt_gcheckout_order_status_note}
{else}
{include file="main/order_status.tpl" status=$order.status mode="select" name="status"}
{/if}
{else}
<b>{include file="main/order_status.tpl" status=$order.status mode="static"}</b>
{/if}

Replace with:

Quote:

{if $usertype eq "A"}
{if $active_modules.Google_Checkout ne '' and $order.extra.goid ne ''}
{include file="main/order_status.tpl" status=$order.status mode="select" name="status" extra="disabled='disabled'"}
<br />
{$lng.txt_gcheckout_order_status_note}
<br /><br />
Shipping vendor:
{include file="main/order_shipping_vendor.tpl" status=$order.shipping_vendor mode="select" name="shipping_vendor"}
{else}
{include file="main/order_status.tpl" status=$order.status mode="select" name="status"}
<br /><br />
Shipping vendor:
{include file="main/order_shipping_vendor.tpl" status=$order.shipping_vendor mode="select" name="shipping_vendor"}
{/if}
{else}
<b>{include file="main/order_status.tpl" status=$order.status mode="static"}</b>
{/if}


Find:


Quote:
{include file="main/subheader.tpl" title=$lng.lbl_tracking_order}



{assign var="postal_service" value=$order.shipping_vendor|truncate:3:"":true}


Replace with:
Quote:

{include file="main/subheader.tpl" title=$lng.lbl_tracking_order}

{assign var="postal_service" value=$order.shipping_vendor|truncate:3:"":true}




Find:
Quote:

{elseif $postal_service eq "Fed"}


{include file="modules/Order_Tracking/fedex.tpl"}




After the line above add:

Quote:

{elseif $postal_service eq "DHL"}
{include file="modules/Order_Tracking/dhl.tpl"}




Many thanks to the original author of this mod. It's just what the doctor ordered for my site. I make no promises that this code will work with your site; each environment is different and your code may function differently especially if it has already been moded. I can't provide any support for this mod. Install only if you have the resources to fix any problems that may occur.








__________________
X-Cart Gold v 4.1.10
PHP 5.2.4
MySQL 5.0.45 standard
Apache/2.2.6
OS - Linux
Reply With Quote