[ic] shipping method woes (bad formula error)

Brian Kosick interchange-users@interchange.redhat.com
Wed Aug 22 16:29:00 2001


Hello all,
	I'm trying to figure out a problem with a custom shipping method.  I keep 
getting "Shipping mode 'ground': bad formula. Returning 0.No match found 
for mode 'ground', quantity '2.4', returning 0"

Basically what I'm trying to do is:  The first 2 pounds are a set price, 
for each additional pound over 2, 1 dollar is added to the base price.

Here's my shipping.asc entry which I updated according to the docs

ground  UPS Ground      weight  0       2       4.95
ground  UPS Ground      weight  2       150     f [ground_ship 
weight=@@TOTAL@@]                               ground  UPS 
Ground      weight  150     999999  e Please call for quote.

I've updated actual code from a GlobalSub to an IC Usertag  which is in the 
interchange/usertag dir  Here's the entry:

UserTag ground_ship Order weight
UserTag ground_ship Routine <<EOF
sub {
         use POSIX qw(modf);
         my($TOTAL) = @_;
         my $gcost;
         my $g_total;
         my $g;
         my $h;
         $g_total = $TOTAL;
         ($g,$h) = modf($g_total);
         if ($g > 0)
         {
                 $h++;
                 $g_total = $h;
         }

         $g_total = ($g_total - 2.00);
         $gcost = (4.95 + $g_total);
         return $gcost;
}
EOF
Brian Kosick
Web Programmer
New Age Consulting Service, Inc.
216-619-2000
briank@nacs.net