I have been asked to modify some classic .asp code to split a single column of products into two columns, unfortunately i'm not really experienced with .asp
This i've managed by basically duplicating the code that delivers the table cell, image and copy and adding the following code between:
<%
rs.movenext
%>
Thus is great, but unfortunately when the number of products in a category is not even the site displays an error message in the second column after the final product.
Was wondering if someone could point me in the right direction for what to do to make the code i've added check if the products are all listed before moving onto the second column.
The full code is:
<%
iCount = 0
while not rs.EOF
if iCount mod 2 = 0 then
response.Write("<tr valign=top>")
end if
%>
<tr>
<td width="150" valign="top">
<% if rs("imagefile") & "" <> "" then %>
<a href="<%=getItemName(rs, "")%>?id=<%=rs("id")%>"><img src="../uploads/productimages/<%=rs("imagefile")%>" alt="<%=rs("name")%>" width="150" height="150" border="0" /></a>
<% end if %> </td>
<td valign="top"><h2><%=rs("name")%></h2>
<!-- <p><%=rs("pricesummary")%></p>
<% if 1=0 and rs("specialoffersummary") & "" <> "" then %>
<p><%=rs("specialoffersummary")%></p>
<% end if %>
-->
</p></a>
<p><a href="<%=getItemName(rs, "")%>?id=<%=rs("id")%>">details >></a> </p> </td>
<%
rs.movenext
%>
<td width="150" valign="top">
<% if rs("imagefile") & "" <> "" then %>
<a href="<%=getItemName(rs, "")%>?id=<%=rs("id")%>"><img src="../uploads/productimages/<%=rs("imagefile")%>" alt="<%=rs("name")%>" width="150" height="150" border="0" /></a>
<% end if %> </td>
<td valign="top"><h2><%=rs("name")%></h2>
<!-- <p><%=rs("pricesummary")%></p>
<% if 1=0 and rs("specialoffersummary") & "" <> "" then %>
<p><%=rs("specialoffersummary")%></p>
<% end if %>
-->
</p></a>
<p><a href="<%=getItemName(rs, "")%>?id=<%=rs("id")%>">details >></a> </p> </td>
</tr>
<%
iCount = iCount + 1
rs.MoveNext
wend
out("</table>")
else
response.Redirect("default.asp")
end if %>
Bookmarks