[ic] Set minimum shipping weight
Paul Jordan
interchange-users@icdevgroup.org
Mon Apr 14 17:22:01 2003
> I am trying to set the minimum shipping weight for the total order.
> Each of my items are 1/2lb in weight. If the user has a total weight of
> less than 1 in their cart, I need the total weight of the cart to be
> rounded up to 1. Sounds simple, but I've tried the following:
>
> Tried the suggestions here:
> http://www.icdevgroup.org/pipermail/interchange-users/2001-June/00
> 9223.html
>
> Modified them a little like this:
>
> [seti total_weight][summary format="%s" total=1][/seti]
> [if scratch total_weight <= 1]
> [seti name=weight value="1"][/seti]
> [/if]
>
> and tried it via Perl:
>
> [perl]
>
> if($Scratch->{weight} < '1') {
> return $Scratch->{weight} = 1;
> }
>
> [/perl]
>
You may need to use the assign tag for the first
http://www.icdevgroup.org/cgi-bin/ic/docfly.html?mv_arg=ictags04%2e04
The second one I believe is wrong... the long version...
[perl]
my $total = 0;
foreach my $item (@$Items) {
next unless $item->{weight} > 0;
$total += $item->{quantity} * $item->{weight};
}
if ($total < 1) {
$Tag->assign( { weight => 1, } );
} else {
return;
}
[/perl]
untested...
HTH
Paul