[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Discount problem (left out error message in log file)
On Thu, 16 May 2002, Kevin Walsh wrote:
|>
|> By the way, I'm kind of confused on how to call the discount tag from within
|> Perl. Is "$Tag->discount('ENTIRE_ORDER', $foo)" legal? --Scott
|>
|Yes - as long as $foo contains a valid discount specification.
What if $foo is just a number? Is that acceptable? From reading the
documentation it seems legal to just return a number (it is for an item anyhow;
I'm not 100% sure about the whole order).
|See the [discount] section of the Interchange Tags Reference (ictags)
|for more information.
I've read that quite a few times. :) Anyway, everything seems to be working
okay except that I keep getting an error message like this one in error.log for
the catalog,
/*BEGIN INCLUDED TEXT*/
65.66.23.10 uuszLadh:65.66.23.10 - [16/May/2002:15:38:39 -0700] altchoice
/cgi-bin/altchoice/process.html Discount ENTIR
E_ORDER has bad formula. Returning normal subtotal.
> eval "string" trapped by operation mask at (eval 504) line 1.
> (in cleanup) Undefined subroutine &MVSAFE49123:: called at
/usr/lib/perl5/5.6.1/i386-linux/Safe.pm line 222.
>
/*END INCLUDED TEXT*/
What is strange is that I don't see this until I've set more than one discount.
Here is the code in question again,
/*BEGIN INCLUDED TEXT*/
[comment]Set discounts if basket isn't empty.[/comment]
[if items]
[perl]
$discount1 = 0; $discount2 = 0;
$discount = 0; $discount = 0;
$discounta = $Tag->value('discounta');
$discountb = $Tag->value('discountb');
$discountc = $Tag->value('discountc');
$discountd = $Tag->value('discountd');
$cartname = $Tag->value('c_nickname');
$amount = $Tag->subtotal($cartname, 'noformat');
if ($discounta eq 'on') {
$amount = $amount - ($amount * .2);
$Tag->discount('ENTIRE_ORDER', $amount);
}
if ($discountb eq 'on') {
$amount = $amount - ($amount * .05);
$Tag->discount('ENTIRE_ORDER', $amount);
}
if ($discountc eq 'on') {
$amount = $amount - ($amount * .05);
$Tag->discount('ENTIRE_ORDER', $amount);
}
if ($discountd eq 'on') {
$amount = $amount - ($amount * .1);
$Tag->discount('ENTIRE_ORDER', $amount);
}
[/perl]
[else]
[if discount ENTIRE_ORDER][discount ENTIRE_ORDER][/discount][/if]
[value name=discounta set=""]
[value name=discountb set=""]
[value name=discountc set=""]
[value name=discountd set=""]
[/else]
[/if]
/*END INCLUDED TEXT*/
|--
| _/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
| _/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
| _/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
|_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
|
|_______________________________________________
|interchange-users mailing list
|interchange-users@interchange.redhat.com
|http://interchange.redhat.com/mailman/listinfo/interchange-users
|
--Scott
***********************************************************
/ Custom Web Promotions /
Economical web hosting & online storefronts featuring
Red Hat Linux 7.2 & Red Hat Interchange 4.8.5
http://custweb.com / 888-287-8932 / sales@custweb.com
***********************************************************