[ic] $Tag->shipping and adder problem

Mike Heins mike at perusion.com
Wed Feb 14 22:28:26 EST 2007


Quoting Bruno Cantieni (bruno at digi-land.com):
> > Hi all.
> > I need to calculate the shipping cost for all the available 
> > methods and
> > store this in a hash for later use.
> > I'm doing this as per the following code (excerpt only):
> > [calc]
> > #some code here
> > 	foreach my $mode (@modes) {
> > 		$shipping_hash{'shipmode'}{$mode} = $Tag->shipping_desc(
> > $mode );
> > 		$shipping_hash{'shipcost'}{$mode} = 
> > $Tag->shipping($mode);
> > 	}
> > #some more code
> > return;
> > [/calc]
> > 
> > The cost returned by $Tag->shipping($mode) does not include 
> > the "adder" (and
> > possibly other modifiers) as defined in shipping.asc
> > 
> > I checked this also by doing the following (the adder is 2 in 
> > this example):
> > [calc]return $Tag->shipping('upsg ');[/calc] returns 10.23
> > [shipping upsg] returns $12.23
> > 
> > What gives??
> > 
> > 
> > 
> > Bruno Cantieni
> > 
> Hi again.
> I checked this out on a totally different install, on a totally different
> server.
> Both run 5.2.0
> With a upsg method set I get the following results:
> 
> A) no minimum, no adder, basic charge $3.02
> [calc]return $Tag->shipping('upsg ');[/calc] returns 3.02
> [shipping upsg] returns $3.02
> 
> B) $5 minimum, no adder, basic charge $3.02
> [calc]return $Tag->shipping('upsg ');[/calc] returns 5.00
> [shipping upsg] returns $5.00
> 
> C) $5 minimum, $5 adder, basic charge $3.02
> [calc]return $Tag->shipping('upsg ');[/calc] returns 5.00
> [shipping upsg] returns $8.02
> 
> D) $5 minimum, $5 adder, basic charge 8.73
> [calc]return $Tag->shipping('upsg ');[/calc] returns 8.73
> [shipping upsg] returns $13.73
> 
> The conclusion:
> $Tag->shipping() honours the minimum but not the adder :(
> Bug?

You don't mention what your Adder is. I bet if you made it a flat 5.00
it would work. But I bet you have a [calc] or something producing it.

You can't use $Tag->shipping() in a calc unless you have 5.5,
I think. The problem is that the eval will not work in the safe
compartment of the [calc].

Also, if you have any database tables that are opened in the
shipping mode you are using, they may not work unless you use
[perl tables="tables that need to be opened"] instead of [calc].

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

Unix version of an Outlook-style virus:
It works on the honor system. Please forward this message to everyone
you know, and delete a bunch of your files at random.


More information about the interchange-users mailing list