[ic] Multiple Box Shipping - Internal Lookup SOLUTION

Steve interchange-users@icdevgroup.org
Thu Oct 31 22:11:01 2002


> Hello,
>
> I am switching from WWW UPS lookups to internal database lookup, and
> currently have a routine that splits the weight into 40 lb packages when


Here are the tags for doing an internal database lookup, using the UPS
Tables. I put these in catalog.cfg.
If a zip is supplied that is not in these tables, then we fall back and do a
www ups_query just to be sure. I have found that the zip codes that will not
be in the local tables, will be the Hawaii, and Alaska.

Tested...seems to be working ok, and improvements please let me know.
-Steve



#==========================================================================#
#
# break large weight into smaller units and calculate new freight amounts#
# search maillist ic by Shipping Questions - Multiple Boxes per Item - How
to?
#ship_cost does www ups lookups

UserTag ship_cost Order weight mode zip
UserTag ship_cost Routine <<EOR
sub {
my($weight,$mode,$zip) = @_;
return unless $weight;
$mode = $Variable->{SHIP_DEFAULT_MODE} unless $mode;
$zip = $Variable->{SHIP_DEFAULT_ZIP} unless $zip;
my $total = 0;
if ($weight < 1)
{ $weight = 1 }
$total = int($weight/145) * $Tag->ups_query( {
mode => $mode,
zip => $zip,
weight => 145
} );
$total += $Tag->ups_query( {
mode => $mode,
zip => $zip,
weight => $weight % 145
} );
return $total;
}
EOR

#==========================================================================#
#
# break large weight into smaller units and calculate new freight amounts#
# used for internal ups lookup
#


UserTag ship_cost_i Order weight mode zip upsmode
UserTag ship_cost_i Routine <<EOR
sub {
my($weight,$mode,$zip,$upsmode) = @_;
return unless $weight;
$mode = $Variable->{SHIP_DEFAULT_MODE} unless $mode;
$zip = $Variable->{SHIP_DEFAULT_ZIP} unless $zip;
my $zone = '760';
my $total = 0;
my $w_weight = $weight;
if ($weight < 1)
{ $weight = 1 }
$total = int($weight/145) * Vend::Interpolate::tag_ups($mode, $zip,
145,$zone);
$total += Vend::Interpolate::tag_ups($mode, $zip, $weight % 145,$zone);

if ($total < 1)
{$total = $Tag->ship_cost($w_weight, $upsmode, $zip)}

return $total;
}
EOR


Revised shipping.asc snippet

GNDCOMI: -UPS Ground-
criteria weight
zone 760
geo zip
default_geo 04175
adder (@@TOTAL@@ * .015) + 2
table Ground
ui_ship_type UPSI

min 0
max 0
cost e Nothing to Ship!

min 0
max 999
cost f [ship_cost_i zip="[either][value zip][or][var
SHIP_DEFAULT_ZIP][/either]" mode="Ground" weight="@@TOTAL@@"
upsmode="GNDCOM"]

min 999
max 9999999
cost e @@TOTAL@@ Too heavy for UPS Std Ground Svcs - Call for Estimate