[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ic] questions about shipping


JT Justman suppressed wrote:
> My solution was to create a custom field on products called dim_weight,
> and populate it for the item with the dimensional weight based on the
> formula: 
> 
> Dimensional Weight = (length x width x height)/194
> 
> Then in shipping.asc I use something like
> 
> criteria        <<EOF
> [perl]
> 	my $total = 0;
> 	foreach my $item (@$Items) {
> 		$total += $item->{quantity} * $item->{dim_weight} > $item->{weight} ?
> $item->{dim_weight} : $item->{weight};
> 	}
> 	return $total;
> [/perl]
> EOF
> 
> What I actually use is more complicated, so I this is off the cuff and
> probably won't work. The idea is to return the total of the bigger weight
> column. 
> 
I haven't tested this either, by the way, but it looks reasonable.
The only problem I can see in the above is an operator precedence
error.

You will need parenthesis around the code to the right of the *, so
it's "quantity * (...whichever weight...)".

Oh, and [calcn] will be more efficient than [perl] for the above.  As
it's a one-shot operation, it probably won't make too much difference
and, as you said, it was only an example.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    suppressed
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.