[ic] Totally items in cart
Mike Heins
interchange-users@interchange.redhat.com
Thu Sep 6 12:53:01 2001
Quoting Chad Wittrock (Chad.Wittrock@uni.edu):
> I have added a 'shipping' field to the standard demo products table. I am
> attempting to total the shipping values of all the items in the cart when a
> person views their shopping cart. This is my code:
>
> <snip>
> [perl arg="carts"]
> $ship_total = 0;
>
> # Loop over all items in the main cart
> foreach my $item ( @{$Safe{'carts'}->{'main'}} )
> {
> # Total up all the shipping costs
> $ship_total = $ship_total +
> $item->{'shipping'};
> }
> return ("Shipping: $ship_total");
> [/perl]
> </snip>
>
> This returns 'Shipping: 0'. Am I doing something wrong with my calculation?
Why would you think $item->{shipping} contains anything? It might if
you put
AutoModifier shipping
in your catalog.cfg, but wouldn't otherwise.
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
For a successful technology, reality must take precedence over public
relations, for Nature cannot be fooled. -- Dick Feynman