[ic] Modify my modifier ?

DB db at m-and-d.com
Thu Mar 15 14:10:03 UTC 2012


Hi - I currnetly have the below code in place and it works well. If an
item in the products table has value 1 in the heavy column, an extra
charge is added the the cost of shipping.

===================================================

## add fee for items tagged heavy in products table
AutoModifier heavy

Variable HEAVY_FEE 7.95

Sub custom_shipping <<EOS
sub {
my ($final, $mode, $opt, $o) = @_;

$final += $Variable->{HEAVY_FEE}
if grep {$_->{heavy}} @$Items;

return $final;
}
EOS

SpecialSub shipping_callout custom_shipping

===================================================

I'd like to extend this a bit so that I can choose bewteen two or more
different charges depending on the value of the 'heavy' field. For
exmaple add HEAVY_FEE if heavy=1, or add HEAVY_FEE_2 if heavy=2. I don't
remember where this code came from but I probably didn't write it. If I
had, I'd likely know how to modify it ;) If anyone can provide a hint
I'd be grateful.

DB



More information about the interchange-users mailing list