[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Need more shipping help
****** message to minivend-users from "Christopher P. Lindsey" <lindsey@mallorn.com> ******
> >What I can't figure out now is how to get the quantity for a given item
> >to the subroutine too. @@TOTAL@@ gives the total number of items in the
> >entire basket and [item-quantity] is empty.
>
> So, I'm thinking the other items you have included in the shipping.asc
> could actually be pulled from the GlobalSub directly, by accessing the
> session data. Instead of weight you would send your quantity, instead of
> zip, you could access the state value directly.
This is the approach that I've been trying now, but it's not going
anywhere. :( And I was really hoping to do it with the 's' mode
instead of 'p', but I guess I'll take anything at this point. :)
Doing something like
2-day 2nd day air quantity 0 9999999 f [perl arg="sub items values"]twodays[/perl]
and having a sub like
sub twodays {
my $item;
my $state = $Safe{'values'}->{state};
my $multiplier = $minimum = $total = 0;
if ($state =~ /^(?:OR|ID|CA|UT|NV)$/) {
$multiplier = .20; $minimum = 10;
} elsif ($state =~ /^AK$/) {
$multiplier = .35; $minimum = 18;
} else {
$multiplier = .30; $minimum = 10;
}
#breaks here
foreach $item (@{$Safe{items}}) {
if ($item->{shipping_id} == 0) {
$total += $item->{price};
}
}
if ($total > 0) {
return ($total * $multiplier > $minimum) ? $total * $multiplier : $minimum;
} else {
return 0;
}
}
works up to the point where it says 'breaks here'. I can't seem to access
anything in $Safe{items}. But I'm sure I'm doing something stupid... :)
> Oh, and one more *really* interesting tidbit, which may or may not still
> work. The author mentions the ability to place a variable directive in the
> catalog.cfg:
Now that *is* interesting... I'll have to try that! :)
Any thanks for the pointers...
Chris
P.S. Once I get this darned thing working, I'll write it up and send my
specific solution to the list. Maybe I can save someone else all
of this grief. :)
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list