[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 Ryan Hertz <rhertz@gyb.baits.com> ******
At 06:24 PM 1/3/2000 , you wrote:
>****** message to minivend-users from "Christopher P. Lindsey"
><lindsey@mallorn.com> ******
>
>My goal is to fill your mailboxes with nothing but mail from me today.
Ha!
>No, seriously, I'm having problems with orders when the quantity is > 1.
>Here's my line in shipping.asc:
>
> 2-day 2nd day air quantity 0 9999999 s twoday
> price, shipping_id,;[value state]
>
>This calls the subroutine 'twoday' which performs all kinds of calculations
>based on shipping destination, whether or not shipping should be charged,
>etc.
>
>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.
[item-quantity] would only work inside an [item-list].
I've got an _old_ printout from the mailing list that mentions creating a
Globalsub, they (may have been Mike Heins) named it 'ups_plus' and calling
it from shipping.asc with this:
[perl sub]ups_plus ([item-list] [item-data weight] * [item-quantity] +
[/item-list]) + 0[/perl]
This would send the total of weight * quantity for all products to a
sub. Here's the sub they included:
GlobalSub <<EOF
sub ups_plus {
my ($weight) = @_;
my ($zip) = $Vend::Session->{'values'}->{zip};
my ($mode) = $Vend::Session->{'values'}->{mv_shipmode};
my $base = Vend::Interpolate::tag_ups($mode, $zip, $weight);
die "Lookup failed for $mode, $zip, $weight.\n" unless $base > 0;
return $base + 5;
}
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.
Hope this helps, I really don't know anything about shipping formulas or
globalsubs -- my shipping is price based on a simple formula. I've just
been studying it for a while. :-)
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:
Variable <<EOF
SHIP
[perl sub]
ups_plus
(
[item-list]
[item-data weight] * [item-quantity] +
[/item-list] + 0
)
[/perl]
EOF
and then you could call it from shipping like this:
ups UPS Ground weight 1 150 f __SHIP__
Ryan Hertz tel 800-645-BAIT
Webmaster fax 520-645-2588
Advertising Director http://www.insideline.net
Gary Yamamoto Custom Baits, Inc. http://www.yamamoto.baits.com
-
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