[ic] UPSE Online, special handling charge, adder

Peter peter at pajamian.dhs.org
Fri Aug 21 01:16:44 UTC 2009


On 08/20/2009 05:43 PM, DB wrote:
> I'm now wondering how this could be modified to add the
> UPS_OVERSIZED_FEE for each item in the cart which has products.oversized
> set to 1. For example if the cart contains qty 2 of one such item and
> qty 3 of another, then add  5 * UPS_OVERSIZED_FEE
> 
> I'm no perl guru as you'll now see, but maybe something like this (no
> laughing please)
> 
> ================
>  AutoModifier oversized
> 
>  Variable UPS_OVERSIZED_FEE 25.00
> 
>  Sub custom_shipping <<EOS
>  sub {
>      my ($final, $mode, $opt, $o) = @_;
> 
> # start my hack
> my $oversize_qty=0;
> foreach my $item (@$Items)
>  {
>  $current_quantity = $item->{quantity};
>  $oversize_qty=$oversize_qty + $current_quantity;
>  }
> 
>     $final += $Variable->{UPS_OVERSIZED_FEE} * $oversize_qty
> # end my hack
> 
>          if grep {$_->{oversized}} @$Items;
> 
>      return $final;
>  }
>  EOS
> 
>  SpecialSub shipping_callout custom_shipping
> ===================

That will result in the oversized fee being applied to all items
regardless of whether they have the oversized flag set or not if at
least one of them is oversized.  If this is what you want, then fine,
otherwise see Daniel's reply.


Peter




More information about the interchange-users mailing list