[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Complicated shipping problem (for me)
****** message to minivend-users from "Christopher P. Lindsey" <lindsey@mallorn.com> ******
> I have done something similar on a site. I wrote a little [perl] to check
> for the conditions and then remove the shipping types, so that when it
> [loop]'s through the string to create the drop down to select shipping
> types, they are not shown. I believe Mr. Heins has suggested writing a
> custom UserTag to calculate your shipping in cases like this.
Cool. Took a while to figure out the syntax, but I have something
working.
Thanks!
For those interested (and for the archives), I'm including the UserTag
below. No laughing please. :)
Chris
----------------------------------------------------------------------
Here's how it's supposed to work:
Orders to WA, OR, ID, CA, UT, & NV: Ground 15% of total, $5.00 min.
Orders to OR, ID, CA, UT, & NV: 2day air 20% of total, $10.00 min.
Orders to all states except AK: 2day air 30% of total, $10.00 min.
Orders to AK: 2day air 35% of total, $18.00 min.
Orders to British Columbia, Canada: Ground 35% of total, $12.00 min.
Orders to other parts of Canada: Ground 40% of total, $15.00 min.
This only limits the shipping options in the pulldown menu. Setting minimum
order values comes later.
In catalog.cfg:
# checkshipmodes: only return list of available shipping modes for
# a given state/country combination
#
# returns a list matching the codes column in shipping.asc
UserTag checkshipmodes InsideHTML
UserTag checkshipmodes Order state country
UserTag checkshipmodes Routine <<EOR
sub {
my ($state, $country) = @_;
my $shipmode;
return "noship" if $state eq "HI";
$shipmode .= "ground " if ($state =~ /^(?:WA|OR|ID|CA|UT|NV)$/ ||
$country !~ /^(?:United States|US)$/i);
$shipmode .= "2-day" if ($state ne "WA");
return $shipmode;
}
EOR
In ord/checkout.html (replacing the section under the default "Choose
your shipping method" section):
<SELECT MV=loop MV.ARG="[checkshipmodes
state='[value state]' country='[value country]'
]"
MV.OPTION="mv_shipmode"
onChange="this.form.submit()"
NAME="mv_shipmode"
>
<OPTION VALUE="[loop-code]"> [shipping-desc [loop-code]] [shipping [loop-code]]
</SELECT>
-
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