Forum OpenACS Q&A: Response to wanna show subtotal price of items in shopping cart

Oops. I misread your post. I didn't see the shopping cart part of your message. The easiest way is to add this code in the while loop:

set subtotal [expr [lindex [ec_lowest_price_and_price_name_for_an_item $product_id $user_id] 0]*$quantity + $subtotal]

you also have to add some code just before the while loop:

set subtotal 0
set product_counter 0
while { ... } {

Anyway, you can use the $subtotal variable and use that in your HTML code.

Now, please note that you would be calling this function twice in shopping-cart.tcl. Once in ec_price_line and once as stated above. It's not the most efficient way to do it, but it is the easiest :) One more thing, you might have to play around with the precision in tcl. Right now, my test cases only show the first decimal point if they hundredths digit is a 0.