[ic] Modify my modifier ?

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


> Just loop through the items and determine the highest value of heavy.
> Take this maximum to pick the variable you need.
> 
> Regards
> 	Racke
> 
> 
> -- 
> LinuXia Systems => http://www.linuxia.de/
> Expert Interchange Consulting and System Administration
> ICDEVGROUP => http://www.icdevgroup.org/
> Interchange Development Team

Here is my feeble attempt which seems to not do anything. Does anyone
see what may be wrong with this (in between fits of laughter of course)?


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

Variable HEAVY_FEE 7.95
Variable HEAVY_FEE_2 8.95

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

    my $additional_fees = 0;

    for my $item (@$Items) {
        next unless $item->{heavy};
        my $quantity = $item->{quantity} || 1;
        my $heavy = $item->{heavy};
        my $heavy_fee=0;

          if ($heavy==1) {
           $heavy_fee = $Variable->{HEAVY_FEE};
          }

          if ($heavy==2) {
           $heavy_fee = $Variable->{HEAVY_FEE_2};
          }

        my $item_fee = $quantity * $heavy_fee;

        $additional_fees += $item_fee;
    }

    $final += $additional_fees;

    return $final;
}
EOS



More information about the interchange-users mailing list