[ic] $Tag->discount problem

Stefan Hornburg racke at linuxia.de
Thu Feb 19 13:55:58 EST 2004


On Thu, 19 Feb 2004 18:38:15 +0000
Andy Mayer <andy at andymayer.net> wrote:

> 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?

I recommend to check your error log.

You probably need to pre-open some data sources like that:

[perl tables="products price"]

bye
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team




More information about the interchange-users mailing list