Copy link to clipboard
Copied
I have created a template for displaying product information and collecting order information using Dreamweaver MX.
Without including all of my checks and balances, below is the repeating area of the page.
What I am struggling with now is figuring out how to calculate the total dollare amount spent. Because I do not have a set number of products or rows in the table this page is pulling the product data from, I cannot use an array.
<table width="780" border="0" cellspacing="0" cellpadding="0">
<!-- TemplateBeginRepeat name="Product1" -->
<tr>
<td colspan="6"><img src=".../.../images/header.jpg"></td>
</tr>
<tr>
<td colspan="6"><div align="center"><br>Click on any of the product images to view a larger image.
<br>
This will open a new window, so please allow popups for this website.<br><br></div></td>
</tr>
<tr height="20" bgcolor="#d81e05">
<td width="121" valign="middle"><div align="center"><strong><u><font color="#FFFFFF">Item</font></u></strong></div></td>
<td width="400" valign="middle"><div align="center"><strong><u><font color="#FFFFFF">Description</font></u></strong></div></td>
<td width="127" valign="middle"><div align="center"><strong><u><font color="#FFFFFF">Size</font></u></strong></div></td>
<td width="72" valign="middle"><div align="center"><strong><u><font color="#FFFFFF">Price</font></u></strong></div></td>
<td width="60" valign="middle"><div align="center"><strong><u><font color="#FFFFFF">Qty</font></u></strong></div></td>
</tr>
<tr>
<td colspan="5" height="10"> </td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsProducts.EOF))
%>
<tr>
<td valign="top"><div align="center">
<!-- TemplateBeginEditable name="ItemNumber" -->
<a href=".../images/large/<%=(rsProducts.Fields.Item("itemnumber").Value)%>.jpg" target="_blank" border=0><img src=".../images/thumbnails/<%=(rsProducts.Fields.Item("itemnumber").Value)%>.jpg" border="0"></a><br>
<%=(rsProducts.Fields.Item("itemnumber").Value)%><br>
<%=(rsProducts.Fields.Item("productname").Value)%> <!-- TemplateEndEditable --></div></td>
<td valign="top">
<!-- TemplateBeginEditable name="Description" -->
<%=(rsProducts.Fields.Item("description").Value)%> <!-- TemplateEndEditable --></td>
<td valign="top"><div align="center">
<!-- TemplateBeginEditable name="Sizes" -->
<% if (rsProducts.Fields.Item("size1").Value) <> "NULL" then%>
<%=(rsProducts.Fields.Item("size1").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("size2").Value) <> "NULL" then%>
<%=(rsProducts.Fields.Item("size2").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("size3").Value) <> "NULL" then%>
<%=(rsProducts.Fields.Item("size3").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("size4").Value) <> "NULL" then%>
<%=(rsProducts.Fields.Item("size4").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("size5").Value) <> "NULL" then%>
<%=(rsProducts.Fields.Item("size5").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("size6").Value) <> "NULL" then%>
<%=(rsProducts.Fields.Item("size6").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("size7").Value) <> "NULL" then%>
<%=(rsProducts.Fields.Item("size7").Value)%><br><br>
<% end if %>
<!-- TemplateEndEditable --></div></td>
<td valign="top"><div align="center"><!-- TemplateBeginEditable name="Price" -->
<% if (rsProducts.Fields.Item("price1").Value) <> "NULL" then%>
$<%=(rsProducts.Fields.Item("price1").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("price2").Value) <> "NULL" then%>
$<%=(rsProducts.Fields.Item("price2").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("price3").Value) <> "NULL" then%>
$<%=(rsProducts.Fields.Item("price3").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("price4").Value) <> "NULL" then%>
$<%=(rsProducts.Fields.Item("price4").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("price5").Value) <> "NULL" then%>
$<%=(rsProducts.Fields.Item("price5").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("price6").Value) <> "NULL" then%>
$<%=(rsProducts.Fields.Item("price6").Value)%><br><br>
<% end if %>
<% if (rsProducts.Fields.Item("price7").Value) <> "NULL" then%>
$<%=(rsProducts.Fields.Item("price7").Value)%>
<% end if %>
<!-- TemplateEndEditable --></div></td>
<td valign="top"><div align="center">
<!-- TemplateBeginEditable name="OrderQty" -->
<% if (rsProducts.Fields.Item("price1").Value) <> "NULL" then%>
<input name="txt_qty1_<%=(rsProducts.Fields.Item("itemnumber").Value)%>" type="text" size="6" class="kickdown"/><br>
<% end if %>
<% if (rsProducts.Fields.Item("price2").Value) <> "NULL" then%>
<input name="txt_qty2_<%=(rsProducts.Fields.Item("itemnumber").Value)%>" type="text" size="6" class="kickdown"/><br>
<% end if %>
<% if (rsProducts.Fields.Item("price3").Value) <> "NULL" then%>
<input name="txt_qty3_<%=(rsProducts.Fields.Item("itemnumber").Value)%>" type="text" size="6" class="kickdown" /><br>
<% end if %>
<% if (rsProducts.Fields.Item("price4").Value) <> "NULL" then%>
<input name="txt_qty4_<%=(rsProducts.Fields.Item("itemnumber").Value)%>" type="text" size="6" class="kickdown" /><br>
<% end if %>
<% if (rsProducts.Fields.Item("price5").Value) <> "NULL" then%>
<input name="txt_qty5_<%=(rsProducts.Fields.Item("itemnumber").Value)%>" type="text" size="6" class="kickdown" /><br>
<% end if %>
<% if (rsProducts.Fields.Item("price6").Value) <> "NULL" then%>
<input name="txt_qty6_<%=(rsProducts.Fields.Item("itemnumber").Value)%>" type="text" size="6" class="kickdown" /><br>
<% end if %>
<% if (rsProducts.Fields.Item("price7").Value) <> "NULL" then%>
<input name="txt_qty7_<%=(rsProducts.Fields.Item("itemnumber").Value)%>" type="text" size="6" class="kickdown" /><br>
<% end if %>
<!-- TemplateEndEditable --></div></td>
</tr>
<tr>
<td colspan="5" height="15" bgcolor="#d81e05"> </td>
</tr>
<tr>
<td colspan="5" height="10"> </td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsProducts.MoveNext()
Wend
%>
<!-- TemplateEndRepeat -->
</table>
Copy link to clipboard
Copied
This question has nothing to do with Dreamweaver Templates, right? It's all about ASP/VBScript and how to use it to get totals is it not? Why not define some variable, and add each individual price to it for each of the price tests you are doing? Then you can print that variable's value wherever you want.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more