[ic] Totally items in cart

Chad Wittrock interchange-users@interchange.redhat.com
Thu Sep 6 12:23:00 2001


THANK YOU ED!!!

Chad

> -----Original Message-----
> From: interchange-users-admin@interchange.redhat.COM
> [mailto:interchange-users-admin@interchange.redhat.COM]On Behalf Of Ed
> LaFrance
> Sent: Thursday, September 06, 2001 11:00 AM
> To: interchange-users@interchange.redhat.COM
> Subject: Re: [ic] Totally items in cart
>
>
> At 08:54 AM 09/06/2001 -0500, you wrote:
> >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?
> >
> >Any help is greatly appreciated.
> >Chad
>
> The shipping value wouldn't be stored in the cart unless you had
> setup your
> catalog to treat it as a modifier and modified order functions to insert
> it.  To do what you want you could try something like:
>
> [set total_shipping]0[/set]
> [item-list]
>          [seti total_shipping][calc]
>                  [scratch total_shipping] + ([item-field shipping] *
> [item-quantity])
>          [/calc][/seti]
> [/item-list]
> ...
> Shipping: [currency][scratch total_shipping][/currency]
>
> - Ed L.
>
>
>
>
> ===============================================================
> New Media E.M.S.               Software Solutions for Business
> 463 Main St., Suite D          eCommerce | Consulting | Hosting
> Placerville, CA  95667         edl@newmediaems.com
> (530) 622-9421                 http://www.newmediaems.com
> (866) 519-4680 Toll-Free       (530) 622-9426 Fax
> ===============================================================
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
>