[ic] $Tag->discount problem

Andy Mayer andy at andymayer.net
Thu Feb 19 13:38:15 EST 2004


Hi,

The following perl code is in my checkout page, just before listing the
basket items. 

I am wanting to apply the following discounts: Orders of £20.00 or more:
5% discount,  £50.00 or more: 10% discount,  £100.00 or more: 15%
discount.


[perl]
my $ordertotal = $Tag->subtotal({noformat => 1});
my $text;
if ($ordertotal > 100) {
$text="<P>You qualify for 15% discount because your order is over
&#163;50.";
$Tag->discount(  { code => ENTIRE_ORDER }, '$s * .85'  );
 } elsif ($ordertotal > 50) {
                $text="<P>You qualify for 10% discount because your
order is over &#163;50.";
                $Tag->discount(  { code => ENTIRE_ORDER }, '$s * .90' 
);
        } elsif ($ordertotal > 20) {
                $text="<P>You qualify for 5% discount because your order
is over &#163;20.";
                $Tag->discount(  { code => ENTIRE_ORDER }, '$s * .95' 
);
        } else {
                $text="You do not qualify for a discount.";
        }
        $Scratch->{ordertotal} = $ordertotal;
        return $text;

[/perl]

It doesn't seem to work. Any ideas?

Many thanks!

Andy



More information about the interchange-users mailing list