% Option Explicit %>
<%
dim AlbumNo : AlbumNo = getAlbumNo(Request.form)
if AddToCart(AlbumNo) = False then Response.redirect "viewcart.asp" ' redirects if AlbumNo is already in the cart
%>
Untitled Document
<%
DisplayHeader "Shop"
DisplayNavMenu "Shop"
%>
<%
sub Main()
dim rs
dim albumNumbers, quantities, i
dim subTotal
Response.write "
"
' if there is more than one album in the cart
if ubound(albumNumbers) > 0 then
Response.write "
" & _
"
Your shopping cart also contains:
" & _
"
"
' displays albums (except the newly added album) in the order albums were chosen by user
for i = 0 to ubound(albumNumbers) - 1
rs.filter = adFilterNone
rs.filter = "AlbumNo=" & albumNumbers(i)
subTotal = subTotal + (quantities(i) * rs("OurPrice"))
displayAlbumInfo rs, quantities(i)
Response.write "
"
next
end if
rs.close
set rs = Nothing
Response.write "
" & _
"
Subtotal: " & formatCurrency(subTotal) & "
" & _
"
"
end sub
%>
<% sub displayAlbumInfo(rs, quantity) %>
<% end sub %>
<%
' req is Request.form
function getAlbumNo(req)
dim field
for each field in req
if inStr(field, "Add") then
getAlbumNo = ExtractAlbumNoFromString(field)
exit function
end if
next
end function
%>