
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Help with custom shipping
At 05:15 PM 10/23/2001 -0500, you wrote:
>Help! I have been trying to write a custom shipping formula, wiht no
>luck. Here's the info:
>
>products database has an additional field called ship_charge, set to Yes/No
>
>Shipping should be charged at a $3 flat rate per item for thos marked yes,
>no shipping charge for those marked no.
>
>How can I look up the ship_charge field from the shipping formula? I'm
>stuck, and my boss is getting impatient.
>
>################## In after.cfg:
>
>UserTag bgcalc Order cart
>UserTag bgcalc Routine <<EOR
>sub{
> my ($name) = @_;
> my ($cart, $item, $yn);
> if($name) {
> $cart = $Vend::Session->{carts}{$name};
> }
> else {
> $cart = $Vend::Items;
> }
> my $charge = 0;
> foreach $item (0 .. $#$cart) {
> $yn = $cart->[$item]{'ship_charge'};
> if($yn =~ /Yes/i) {
> $charge++;
> }
> }
> return $charge;
>}
>EOR
>
>################# In shipping.asc:
>
>bgship Standard [bgship] 0 0 0
>{'Price Divide' => "1",}
>bgship Standard [bgship] 0 999999 f @@TOTAL@@ * [var
>SHIP_FLAT_DOM_RATE] {'PriceDivide' => "1",}
>
>#################
>
>Obviously I'm off the mark somewhere, but an afternoon of head-pounding
>hasn't shown me the light yet...
>
>Thanks in advance,
>
>--Moe Pitman
>Lone Star Internet
I don't think you need a usertag for this. If you make ship charge a 1/0
field (1 for items to be charged, 0 or blank for those that should not), a
shipmode like this in shipping.asc should work without any other steps
being needed ( -> represents a TAB), after a catalog reconfig:
myflat -> Standard Shipping -> ship_charge -> 0 -> 0 -> e No shipping charge
myflat -> Standard Shipping -> ship_charge -> 0 -> 999999 -> f @@TOTAL@@ *
[var SHIP_FLAT_DOM_RATE]
- Ed L.
===============================================================
New Media E.M.S. Software Solutions for Business
463 Main St., Suite D eCommerce | Consulting | Hosting
Placerville, CA 95667 edl@newmediaems.com
(530) 622-9421 http://www.newmediaems.com
(866) 519-4680 Toll-Free (530) 622-9426 Fax
===============================================================
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users