uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Products
       uTest
       uReserve
       uShop
       uStorekeeper
       uGolf
       uDirectory
       uSignIn
 Tech Support
       Support Policy
       Knowledge Base
            uTest
            uReserve
            uShop
            uStorekeeper
            uGolf
            uDirectory
            uSignIn
       Documentation
       Reference Sites
 Legal
       Software Piracy
       Legal Notices
       Privacy Policy
       Licensing
 Miscellaneous
       Reseller Info
       Contact Us
       Site Map
Custom Shippping for 7 world zones

Knowledge Base Lobby : uShop Support Conference : Tax, Shipping, and Handling Questions
Nov-18-17 03:39 AM EST
Original Message
Custom Shippping for 7 world zones
Author Leighton on 08-31-2002 at 14:09 (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.
TABLE OF CONTENTS

Table Of Contents
  RE: Custom Shippping for 7 world zones Bill Weiner, 2002-09-03 04:20:03 (1)
            Custom Shippping for 7 world zones Leighton, 2002-09-03 06:07:01 (2)
                 Shipping by Multiple Zones Brian Levine, 2002-09-03 09:18:31 (3)
                 RE: Custom Shippping for 7 world zones Bill Weiner, 2002-09-04 05:21:19 (4)

Messages In This Discussion
         1. RE: Custom Shippping for 7 world zones
        Author Bill Weiner on 09-03-2002 at 04:20 (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.
TABLE OF CONTENTS
                 2. Custom Shippping for 7 world zones
                Author Leighton on 09-03-2002 at 06:07 (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.
TABLE OF CONTENTS
                         3. Shipping by Multiple Zones
                        Author Brian Levine on 09-03-2002 at 09:18 (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!

TABLE OF CONTENTS
                         4. RE: Custom Shippping for 7 world zones
                        Author Bill Weiner on 09-04-2002 at 05:21 (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.)
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.