[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Need help accessing variables via embeded perl in checkout.html....
Scott Wares wrote:
>The only info returned seems to be a array reference to the cart and the
>number of line items in the order. Could some one tell me what I'm doing
>wrong?
>
>Cat: Item: A_Cat: Cart:ARRAY(0x90c22d8) Ord_Lns:2 Shipping:0
>
>[perl tables=products failure="Perl code error shipping calc failed<BR>"]
> my $cart = $Carts->{main};
> my $item;
> my $shipping=0.00;
> my $t_order_lines=@$cart;
> foreach $item (@cart) {
> my $category = tag_data('products', 'category', $item->{code});
> my $x_items = $x_items . " " . $category;
> if ($category =~ m/TV/){
> $shiping=$shipping + 9.95;
> }else{
> $shiping=$shipping + 1.00;
> }
> }
>
> $shipping_msg="Cat:$category Item:$item A_Cat:$x_items Cart:$cart
>Ord_Lns:$t_order_lines Shipping:$shipping";
>
Do you not have a scope problem with numerous variables only being valid
within the for loop? Wouldn't be more 'correct' to define $category and
$x_items outside the loop and to fix the spelling of shiping?
Barry
--
Barry Treahy, Jr * Midwest Microwave * Vice President & CIO
E-mail: Treahy@mmaz.com * Phone: 480/314-1320 * FAX: 480/661-7028