I am creating a "shopping cart" where I need to add the subtotals into a total.
The following code is in a loop for a recordset based on the items the customer has ordered. On occasion an item is priced differently if bought in a different quantity, which is why there are the different prices and quantities.
The result is a subtotal for the quatity of products ordered. How can I add all of these subtotals into a total?
<%
IF RS("txtprice"
<> "" then
subtotal= (RS("txtquantity"
)*(RS("txtprice"
)
subtotal= formatcurrency(subtotal ,2)
response.write "" & subtotal &""
else
response.write ""
end if
IF RS("txtprice2"
<> "" then
subtotal= (RS("txtquantity2"
)*(RS("txtprice2"
)
subtotal= formatcurrency(subtotal ,2)
response.write "" & subtotal &""
else
response.write ""
end if
IF RS("txtprice3"
<> "" then
subtotal= (RS("txtquantity3"
)*(RS("txtprice3"
)
subtotal= formatcurrency(total ,2)
response.write "" & subtotal &""
else
response.write ""
end if
IF RS("txtprice4"
<> "" then
subtotal= (RS("txtquantity4"
)*(RS("txtprice4"
)
subtotal= formatcurrency(total ,2)
response.write "" & subtotal &""
else
response.write ""
end if
%>
The following code is in a loop for a recordset based on the items the customer has ordered. On occasion an item is priced differently if bought in a different quantity, which is why there are the different prices and quantities.
The result is a subtotal for the quatity of products ordered. How can I add all of these subtotals into a total?
<%
IF RS("txtprice"
subtotal= (RS("txtquantity"
subtotal= formatcurrency(subtotal ,2)
response.write "" & subtotal &""
else
response.write ""
end if
IF RS("txtprice2"
subtotal= (RS("txtquantity2"
subtotal= formatcurrency(subtotal ,2)
response.write "" & subtotal &""
else
response.write ""
end if
IF RS("txtprice3"
subtotal= (RS("txtquantity3"
subtotal= formatcurrency(total ,2)
response.write "" & subtotal &""
else
response.write ""
end if
IF RS("txtprice4"
subtotal= (RS("txtquantity4"
subtotal= formatcurrency(total ,2)
response.write "" & subtotal &""
else
response.write ""
end if
%>