[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] help with [calc] please
Hi Otis -
To answer your second question first:
> I thought I could do it with [perl], but it looks like [perl] stuff always
> prints stuff back to the browser, and I want to store the calculation of
> Total and print it at the end of the cart, just once. No [perl]?
You have to return an empty string from [perl] or [calc] tags if you don't
want anything showing up in the browser:
[perl]
... your code ...;
''; # return nothing
[/perl]
The [calc] tags will retain values within a page, so you should be able to
change this:
> [if items] [then] [item-list]
> [sql type=list query="SELECT our_retail_price
> FROM product_term WHERE term_id = '[item-code]'"]
> [set our_retail_price][sql-param our_retail_price][/set]
>
> [set total-price]
> [calc][scratch total-price] + [scratch our_retail_price][/calc]
> [/set]
>
> [/sql]
> [/item-list][/then][/if]
>
> Total: [scratch total-price]
to this:
[calc] $total = 0; ''; [/calc]
[if items]
[item-list]
[sql type=list query="SELECT our_retail_price
FROM product_term WHERE term_id = '[item-code]'"]
[calc] $total += [sql-param our_retail_price]; [/calc]
[/sql]
[/item-list]
[/if]
Total: [calc] $total; [/calc]
Larry Leszczynski
larryl@furph.com
--
furph, Inc. WWW/Unix/Windows Solutions 734-513-7763 (voice)
info@furph.com http://www.furph.com 734-513-7759 (FAX)