[ic] Bug in $Tag->subtotal when items discounted?
Thomas J.M. Burton
tom at globalfocusdm.com
Tue Oct 26 12:55:42 EDT 2004
Hello all,
I seem to have encountered a bug when using $Tag->subtotal in embedded
perl while items are discounted. The discounted prices are not being
used when the subtotal is called using perl. Example:
[discount 51005JT] $s * .75 [/discount]
[perl tables="products pricing"]
my $stotal = $Tag->subtotal({name=> main, noformat => 1,});
return $stotal;
[/perl]
The discounted price for the item is $6.75. I have one in my cart and
the discounts display correctly. The value returned by my perl script
shows a subtotal for the item at its regular price ($9).
The catalog's error.log says:
beads /cgi-bin/beads/process.html Discount for 51005JT has bad formula.
Not applied.
> 'eval "string"' trapped by operation mask at (tag 'perl') line 1.
> (in cleanup) Undefined subroutine &main:: called at
/usr/lib/perl5/5.8.1/i386-linux/Safe.pm line 223.
However, if I first assign the subtotal to a scratch variable and use
that in my perl, it works fine. Like so:
[discount 51005JT] $s * .75 [/discount]
[tmp stot][subtotal noformat=1][/tmp]
[perl tables="products auscrystal pricing"]
my $stotal = $Tag->scratch({name => stot,});
return $stotal;
[/perl]
With the above approach, I get the correct subtotal and no error.log entry.
I can still accomplish what I'm doing using this alternat approach, but
I thought this was worth mentioning. If this has already been reported
or if it's not a bug and I'm just doing something wrong, please let me know.
Server Info:
Interchange 5.0
Apache-AdvancedExtranetServer/2.0.47
Mandrake Linux/6.3.92mdk
mod_perl/1.99_09
Perl/v5.8.1
mod_ssl/2.0.47
OpenSSL/0.9.7b
Thanks,
Tom
!DSPAM:417e83e3126657650916981!
More information about the interchange-users
mailing list