www.uburst.com www.uburst.com

"Custom Shippping for 7 world zones"

Go back to the LobbyClick here to Go Back to Main ListingClick here to see helpClick here to Search the Forum

Tax, Shipping, and Handling Questions
Forum Type: Public
Moderator: edmunds
Time Zone: EST
Printer Friendly Format
Original Message
 
"Custom Shippping for 7 world zones"
Posted by Leighton on Aug-31-02 at 02:09 PM (EST)
I would like to implement a custom shipping routine based on weight up to 20kg with increments of 0.5kg for 7 different world zones. I know I could do this with the weight table formula but there are only five fields. Is it possible to achieve this by using custom shipping routine. Thanks in advance.
Click to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents

 Table of Contents

RE: Custom Shippping for 7 world zo..., Bill Weiner, Sep-03-02, (1)
Custom Shippping for 7 world zones, Leighton, Sep-03-02, (2)
Shipping by Multiple Zones, Brian Levine, Sep-03-02, (3)
RE: Custom Shippping for 7 world zo..., Bill Weiner, Sep-04-02, (4)

 

 
Click here to goto Click here to goto the Lobby
Messages in this discussion
 
1 . "RE: Custom Shippping for 7 world zones"
Posted by Bill Weiner on Sep-03-02 at 04:20 AM (EST)
Yes, you can implement almost any type of shipping calculation you want via the custom_shipping subroutine.

If you just want to do a "weight table" lookup in the custom_shipping subroutine, then a trick is to call the "shipping_lookup" subroutine in order to handle looking up the weight/value for you.

So in your custom_shipping subroutine, you would basically just need a call like this:

$ret_value = &shipping_lookup($shipping_table,$totals_total_weight);

If you need to have a different shipping table for each of your 7 "World Zones", then I would suggest first having an "if" to set the $shipping_table accordingly based on your determination of the 7 "World Zones".
Note: In order for the "shipping_lookup" subroutine to function properly, the format of the $shipping_table should be in a format similar to the standard way of setting up shipping tables: "weight1=value1,weight2=value2,....weightN=valueN"

Let us know if you need any more assistance than that.

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
2 . "Custom Shippping for 7 world zones"
Posted by Leighton on Sep-03-02 at 06:07 AM (EST)
Unfortunately my knowledge of perl is at best very poor! Am I right in understanding that I should create 7 named shipping tables in ushop-settings.txt and then the shipping_lookup will use that? Also can you show me how the first two zones would be written in the custom shipping routine using the if statement, as I am sure I can then just copy for the rest. This is how i thought it would go but I know it is wrong :)

sub custom_shipping
{
if ($shipping_method eq "Republic of Ireland")
{
$ret_value = &shipping_lookup($shipping_table,$totals_total_weight);
}
if ($shipping_method eq "Belgium,Luxembourg,Netherlands")
{
$ret_value = &shipping_lookup($shipping_table,$totals_total_weight);

...and so on for the next 5 zones.

Very much appreciate your help Bill.

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
3 . "Shipping by Multiple Zones"
Posted by Brian Levine on Sep-03-02 at 09:18 AM (EST)
Hi. I recently had to do something like this to support the new zoned rates for USPS priority mail. There were 8 possible zones, based on postal code and weight.

Applying my solution to your needs, you would need a table on your server that had 4 columns: Country, WeightLow, WeightHigh, and Amount.

You would then use the following variables provided by the custom_shipping sub:

$shipping_country
$totals_total_weight

You could then query the table based on these:

$sql = "select Amount from ShippingTable where Country = '$shipping_country' and $totals_total_weight > WeightLow and $totals_total_weight <= WeightHigh";

My data is kept in a MySQL database, which is free and already provided by many hosts, but you could use any SQL oriented database. If you would like a copy of my code, email me and I'll send it to you.

Good luck!

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick to EMail Click here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents
 
4 . "RE: Custom Shippping for 7 world zones"
Posted by Bill Weiner on Sep-04-02 at 05:21 AM (EST)

I was thinking that you could automate the calculation based on country by setting up table for each zone such as:

# Assign countries to each zone.
$zone1_countries = "LIST,Ireland,Republic of Ireland";
$zone2_countries = "LIST,Belgium,Luxembourg,Netherlands";
etc.

# Create table for each zone.
$zone1_table = "0=5.00,0.5=5.50,1=6.00,1.5=6.50";
$zone2_table = "0=10.00,0.5=11.00,1=12.00,1.5=13.00";
etc.

Determine the customer's shipping country such as:

# Determine the country.
if ($shipping_country eq "")
{
$country = "\,$billing_country";
}
else
{
$country = "\,$shipping_country";
}

And then finally do the lookup:

if ($zone1_countries =~ /$country/i)
{
$ret_value = &shipping_lookup($zone1_table,$totals_total_weight);
}
elsif ($zone2_countries =~ /$country/i)
{
$ret_value = &shipping_lookup($zone2_table,$totals_total_weight);
}

etc.

But actually, if you just want the customer to manually select the shipping zone, then the easiest thing to do would to just use 7 different shipping methods.... And we recently did a customization to allow 8 different shipping methods... so I'll just send you that version of the ushop-lib.pl script to use. (In reply to your support request.)

Remove this Message: Administrator and Moderator onlyClick to Send Alert Message to the Administrator Click to edit this messageClick here to reply to this messageClick here to reply to this message with quotesClick to goto the Table of Contents


Archive This Thread: Admin and Moderator OnlyRemove This Thread: Admin and Moderator Only
Click here to goto Click here to goto the Lobby

 

 

 

 

 

 

 

 

 

 

 

 
Questions or problems regarding this bulletin board should be directed to Webmaster
©1997-1999 by DCScripts. All rights reserved.