[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: bug? substitution in shipping.asc
Quoting Kyle Hayes (kyle540@quicknet.net):
>
> I have been running tests on what shipping.asc can do.
>
> I am trying to add a routine to calculate insurance for UPS shipping
> without any success.
>
> I have it calling my routine correctly, but it does not pass @@COST@@ as
> the manual indicates should be done.
>
> the call is:
>
> ups_insurance('1',@@COST@@,'2',@@ADDER@@,'3','23.0')
>
> "ups_insurance" is a GlobalSub implemented in minivend.cfg.
>
> When I dump @_ in ups_insurance to the log, I get:
>
> args: 1 2 3 23.0
> num args: 4
>
> Now, there are couple of things that worry me. First, I should be seeing
> something for the @@COST@@ etc. fields. I am not seeing anything at all.
> Second, the number of args returned is 4 not the expected 6. If I put
> single quotes around the @@ variables, I get null strings (but not null or
> undef) back.
>
> According to the manual, @@COST@@ should be replaced by the value returned
> from the UPS look-up routine. It looks like it is returned as undef or
> something.
>
> I tried the @@ADDER@@, @@COST@@ and @@GEO@@ tags to see if they do
> anything. So far, none of them return any values that I can discern.
>
> I tried checking to see if I get references back, and I don't. So, as far
> as I can tell, this is a bug. The tags with @@ are getting parsed in some
> manner because they aren't passed along. But, no values are substituted
> for them.
>
This is one of the worst parts of MiniVend and it is going bye-bye in
4.0, so I wouldn't spend any more time on it. I thought about compatibility
routines but decided that it didn't make any sense to continue to propagate
such ugliness...
I recommend using a UserTag.
upsg UPS straight cost weight 0 150 m [do-ups weight=@@TOTAL@@ mode=Ground adder=4]
error Contact Factory for UPS weight 0 150 e No UPS shipping available.
UserTag do-ups Order mode adder zip
UserTag do-ups Routine <<EOR
sub {
my ($mode, $adder, $zip, $insurance) = @_;
$zip = $::Values->{zip} unless $zip;
my $ups_cost = Vend::Interpolate::tag_ups($mode, $zip, $weight);
return '>>error' if $ups_cost < 0.01;
my $cost = $ups_cost;
# Do your calcs here
return $cost;
}
EOR
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
131 Willow Lane, Floor 2 | || _ \
It's a little-known fact Oxford, OH 45056 | || |_) |
that the Y1K problem caused <mikeh@minivend.com> |___| _ <
the Dark Ages. -- unknown 513.523.7621 FAX 7501 |_| \_\