[ic] Adding variables

Ed LaFrance interchange-users@interchange.redhat.com
Thu Sep 6 16:14:01 2001


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
===============================================================