[ic] !! discount prices in steps !! HELP

Mark Johnson interchange-users@interchange.redhat.com
Fri Aug 10 12:13:00 2001


admin wrote:
> 
> i need help to find a solution to display discount prices from
> total-prices in several steps.
> 
> from 500 DM up to 1000 DM 1%
> from 1000 DM up to 1500 DM 3,5 %
> from 2000 DM up to endless  5,5 %

Note: I'm going to assume the 2000 is a typo and should have read 1500.

[discount ENTIRE_ORDER]
my $perc;
if ($s >= 1500) {
  $perc = 0.055;  
}
elsif ($s >= 1000) {
  $perc = 0.035;
}
elsif ($s >= 500) {
  $perc = 0.01;
}

unless ($perc) {
  delete $Scratch->{discount_amount};
  return;
}

return $Scratch->{discount_amount} = $s * $perc;
[/discount]

Now, you have the correct total discount set, and the amount of the
discount can be retrieved by [scratch discount_amount]. Wrap in
[currency] tag to show as money.

-- 
Mark Johnson
Senior Systems Architect - Professional Services
Red Hat, Inc.
E-Business Solutions
markj@redhat.com
703-456-2912