[ic] Adding variables

Chad Wittrock interchange-users@interchange.redhat.com
Thu Sep 6 16:24:00 2001


Shorter than my last solution. I like that! Thanks Ed and Brian.

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 3:15 PM
> To: interchange-users@interchange.redhat.COM
> Subject: Re: [ic] Adding variables
>
>
> At 02:22 PM 09/06/2001 -0500, you wrote:
> >I am attempting to add two variable on my checkout page and
> don't seem to be
> >getting it right.
> >
> >I found a thread that had some relevance to this at:
> >http://developer2.akopia.com/archive/interchange-users/1998-old/1040.html
> >
> >There is some code there that adds two variables
> >         [set name="ReceiptTotal" interpolate=1][[calc][scratch
> >         DeliveryCharge]+[total-cost][/calc]][/set]
>
> This is non-functional dreck: too many []'s.
>
>
> >I did something very similiar to this:
> >
> ><snip>
> >         <TD ALIGN=RIGHT><font face="sans-serif">
> >                       [set total_shipping]0[/set]
> >                 [item-list]
> >                                 [seti total_shipping][calc]
> >                                 [scratch total_shipping] + ([item-field
> > shipping] *
> >[item-quantity])
> >                                 [/calc][/seti]
> >                 [/item-list]
> >
> >                 [currency][scratch total_shipping][/currency]
> >         </TD>
> ></TR>
> ><TR>
> >         <TD ALIGN=RIGHT width="350"><font face="sans-serif">TOTAL:
> > </font></TD>
> >
> >         [set cart_total][calc][scratch
> > total_shipping]+[subtotal][/calc][/set]
>
>          [seti cart_total][calc][scratch total_shipping]+[subtotal
> noformat=1][/calc][/seti]
>
> When you need to set a scratch variable with the results of the
> interpolation of container tags, you must use [seti...] instead of
> [set...]. Also, currency formatting in [subtotal] will break the
> calculation, thus the 'noformat=1' parameter.
>
> - Ed L.
>
>
> >         <TD ALIGN=RIGHT><font face="sans-serif">[currency][scratch
> >cart_total][/currency]</TD>
> >
> >When I do the calc on cart_total I end up with zero. I followed
> the example
> >exactly, I thought. Does someone see something I don't or am I
> going about
> >this wrong?
> >
> >Any help would be appreciated.
> >Chad
> >
> >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >             ____
> >   |  | |\ |  ||   Chad M. Wittrock (Chad.Wittrock@uni.edu)
> >   \__/ | \| _||_  University of Northern Iowa
> >
> >_______________________________________________
> >interchange-users mailing list
> >interchange-users@interchange.redhat.com
> >http://interchange.redhat.com/mailman/listinfo/interchange-users
>
> ===============================================================
> 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
>