[ic] Bug in $Tag->subtotal when items discounted?
Ed LaFrance (New Media E.M.S.)
ic_users at newmediaems.com
Tue Oct 26 14:09:54 EDT 2004
At 09:55 AM 10/26/2004, you wrote:
>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
I'm not sure if 'name=>' will cause a syntax error in Perl, but you should
insert a space between 'name' and '=>' just to be safe. Other than that,
try giving your catalog global powers. In interchange.cfg, add
AllowGlobal yourcatname
and restart Interhchange. Then add 'global=1' to the opening [perl ...] tag
and see if that fixes it.
- Ed
===============================================================
New Media E.M.S. Technology Solutions for Business
11630 Fair Oaks Blvd., #250 eCommerce | Consulting | Hosting
Fair Oaks, CA 95628 Ed.LaFrance at newmediaems.com
(916) 961-0446 http://www.newmediaems.com
(866) 519-4680 Toll-Free (916) 961-0447 Fax
===============================================================
More information about the interchange-users
mailing list