[ic] shipping.asc not working right

Paul Jordan paul at gishnetwork.com
Mon Jun 24 14:32:37 UTC 2013

> From: interchange-users-bounces at icdevgroup.org
> [mailto:interchange-users-bounces at icdevgroup.org] On Behalf Of kerry
> blalock
> Sent: Sunday, June 23, 2013 7:19 AM
> To: interchange-users at icdevgroup.org
> Subject: [ic] shipping.asc not working right
> I am trying to add an additions shipping method to my site and seem to be
> having a problem with the logic. Here is the code that is giving me an
error on
> the truckbig method:
> truckbigger:      Oversize Truck Shipping
>         criteria <<EOC
> [calcn]
>         foreach my $item (@$Items) {
>                 if ($item->{width} >= 160) {
>                         # We have to use this shipping method
>                         return 1;
>                 }
>         }
>         return 0;
> [/calcn]
>         min     1
>         max     1
>         cost    170.00
> truckbig:	Truck Shipping
> 	criteria <<EOC
> [calcn]
> 	foreach my $item (@$Items) {
> 		if (($item->{width} >= 108 and ($item->{width} <=160)) {
> 			# We have to use truckbigger shipping method
> 			return 1;
> 		}
>        }
>        return 0;
> [/calcn]
>         min     1
>         max     1
>         cost    85.00
> Truckbigger works as is. But when I want to charge less for rods between
> and 160, I get an error,
> Note: No match found for mode 'ground', quantity '', returning 0.
> Shipping defaults to the shippin method just below truckbig method. Need
> fresh eyes to help me figure out why this is not working.

I know this might sound crazy, but try putting the truckbig above the
truckbigger method. I have found oddities in the past that lead me to
believe (at times), the system does a substring match on shipping methods. I
think your truckbig is never getting found because of it. I am most likely
wrong, but try it for giggles. 

If all you are doing is raising the price on these (assuming these are not
simplified for your question), you can combine them, just return a '2' for
above 160 and have 2 cost 170. You can also explicitly call truckbigger from
inside of truckbig like this:

    min         2
    max         2
    cost        >>truckbigger

Your #comment in truckbig is incorrect BTW.

Oh, one other thing (that I am probably also wrong about). At times, I have
noticed that things don't work as I expect if they don't have one-more-final
cost above my maximum. IIRC I may have reported this and it may have been an
actual bug (and fixed) but I have a habit of adding just one more anyways.
So for you, you can add a...

   min 3
   max 3
   cost 200

It will never be invoked, but things have led me to believe it is necessary.

As you can see, my shipping.asc is by habit built upon folklore and
wives-tales, but probably like you, once I get it working, I don't dare
question anything I have done.


More information about the interchange-users mailing list