[ic] HOW TO - Adding extra weight to shipping calculations
Marty Tennison
marty at sediva.com
Sat Nov 4 19:29:19 EST 2006
Here is a little "How To" guide for one way to add a specific amount of
weight to an order before shipping is calculated.
I did a search in the archives and found threads on this subject but no
solution so I thought I would post mine. There is probably an easier
way, but I could not figure one out. :)
Here is the situation. Lets say you want to add the weight of packaging
materials into the shipping cost calculation. In our particular case,
we needed to add a certain amount of weight to an order if it is under 1
pound, a different amount if it is over 2 pounds and so on...
What I did.
1) Create a UserTag that returns the weight of items plus any extra.
2) Modify Shipping.asc to use this ITL tag as the criteria.
Here is the tag...
================================
UserTag ship-weight Order weight
UserTag ship-weight Interpolate
UserTag ship-weight Routine <<EOR
sub {
my ($weight) = @_;
my $out;
if ( $weight <= 1 ) {
$out = ( $weight + .35 );
}elsif ( $weight <= 2 ) {
$out = ( $weight + .55 );
}elsif ( $weight <= 3 ) {
$out = ( $weight + .75 );
}elsif ( $weight <= 10 ) {
$out = ( $weight + 1 );
}else{
$out = ( $weight + 2 );
}
return $out;
}
EOR
==============================
Here is a snipet from my shipping.asc file...
=============================
uspspm: US Postal - Priority Mail
criteria [ship-weight weight="[weight]"]
min 0
max 1
cost 4.99
min 1
max 2
cost 6.99
min 2
max 3
cost 9.99
min 3
max 4
cost 11.99
min 4
max 5
cost 13.99
min 5
max 6
cost 15.99
min 6
max 70
cost f 6.25 + (2.25 * @@TOTAL@@)
==============================
Not sure if anyone will find that useful but thought I would post it
just in case. Enjoy.
--
- - -- ---- ---------------------------- --- -- - -
Marty Tennison
www.sediva.com
www.dipdepot.com
- -- --- --------------------------------------- --- --
More information about the interchange-users
mailing list