
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Help with custom shipping
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
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users