
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] shipping method woes (bad formula error)
Well I went home, came in fresh, and figured this out in 5 minutes, and am
posting this to the mail list for future use.
All I had to do was add single quotes around @@TOTAL@@
ground UPS Ground weight 0 0 e Nothing to
Ship! {'ui_ship_type' => "weight",'ups' => "0",'PriceDivide' => "1",}
ground UPS Ground weight 0 2 4.95 {'PriceDivide' => "1",}
ground UPS Ground weight 2 150 f [de_custom_ship
baseprice="4.95" weight='@@TOTAL@@'
shipcalc_start_weight="2.00"] {'PriceDivide' => "1",}
ground UPS Ground weight 150 999999 e Please call for quote.
Then I cleaned up the usertag code ;-)
###############################################################################
# This tag provides the custom shipping routine that Diabetic Express uses
# to calculate shipping
#
# Basically it's 1 set price for the first two pounds, after that, it's an
# additional dollar for each pound.
UserTag de_custom_ship Order baseprice weight shipcalc_start_weight
UserTag de_custom_ship Routine <<EOR
sub
{
use POSIX qw(modf);
my($baseprice, $weight, $shipcalc_start_weight) = @_;
my $x;
my $y;
my $actualshipweight = $weight;
my $shipcost;
# Check to see if modulo is greater than 0.
($x, $y) = modf($weight);
# If it is round up to next pound.
if ($x > 0)
{
$y++;
$actualshipweight = $y;
}
$actualshipweight = ($actualshipweight - $shipcalc_start_weight);
$shipcost = ($baseprice + $actualshipweight);
return $shipcost;
}
EOR
Brian Kosick
Web Programmer
New Age Consulting Service, Inc.
216-619-2000
briank@nacs.net
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users