X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Ability to select shipping carrier for tracking numbers (https://forum.x-cart.com/showthread.php?t=9345)

inksticks 09-14-2004 07:51 AM

Ability to select shipping carrier for tracking numbers
 
X-cart chooses the shipping carrier based and the shipping selection that the customer used when checking out. However, to change the carrier and have the tracking function still work. Here is a mod that will allow you to select which shipping carrier you used: UPS, Fedex, USPS and will associate xcarts tracking functions to the option you selected.

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.

Code:

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


Then you need to replace the following code in your admin/order.php

Code:

db_query("update $sql_tbl[orders] set tracking='$tracking', notes='$notes', details='".


With this code:

Code:

db_query("update $sql_tbl[orders] set tracking='$tracking', notes='$notes', ".
"shipping_vendor='".$shipping_vendor."', details='".
                       


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

Code:

{* $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>
</SELECT>


Finally you will need to edit template file 'main/history_order.tpl'.

Replace the following:

Code:

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

With this

Code:

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

And add the following:
Code:



Shipping vendor:
{include file="main/order_shipping_vendor.tpl" status=$order.shipping_vendor mode="select" name="shipping_vendor"}


After this line in the main/history_order.tpl

Code:

{include file="main/order_status.tpl" status=$order.status mode="select" name="status"}


After applying this mod when you log in to view your order to enter tracking numbers right above your tracking number box you can select which shipping carrier was used. After applying your changes you will see a 'track it' button at the bottom of the page that allows you to track the shipment.

adpboss 09-14-2004 09:09 AM

Nice mod. I assume this is for 4.0.3.

inksticks 09-14-2004 09:14 AM

version 4.0.3
 
Yes, it is for 4.0.3.

eleven 09-28-2004 07:23 PM

3.4.11 ?
 
Do you guys know offhand if this mod will work with 3.4.11? It looks like it's almost a stand-alone mod.

inksticks 09-29-2004 05:47 AM

It was designed for 4.x but you could try on 3.4.11. You should try and post back to the forum your results. I personally have not tried it on 3.4.11.

jimmy_ 09-30-2004 11:50 PM

Thank you for this mod, everything seems to be working except the Track It button does not show up.


I was wondering where exactly this track IT button shows up (I assumed it would be on the page around where I chose shipping company, and entered tracking... but I do not see it;(


Any assistance would be greatly appreciated.

Thanks :D


using v4.0.4 X-CART

inksticks 10-01-2004 07:31 AM

The 'track it' button is on the bottom of the 'Order details' page (the same page that you select your shipping carrier and enter your tracking number) You need to select a carrier and enter a tracking number and click apply changes near the bottom of the page. Then go back to the same order again and you will see the 'track it' button at the bottom of the page. Please let me know if you need further assistance.

bluecat 01-08-2005 07:46 PM

I'm using 4.0.9. In your second step, the code doesn't match up and I'm not sure how to change it. Could anyone take a stab? This is my code:

Code:

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

sportruck 04-06-2005 10:56 AM

If your code doesn't match the SQL query listed above, here is what to do.


In admin/order.php, change this line:

Code:

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

To this:

Code:

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

Works great!

chilll33 04-07-2005 08:19 AM

Works Perfectly with 4.0.13.


All times are GMT -8. The time now is 06:40 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.