%@ LANGUAGE="VBSCRIPT" %>
<%
HTMLtitle="My Cart"
%>
<%
Function AddToExistingItem(V,ARYcart2)
For comp = 0 to 50
If ARYcart2(comp,1) = V then
ARYcart2(comp,2) = ARYcart2(comp,2) + 1
duplicate = 1
'iCount = iCount-1
end if
next
AddToExistingItem = ARYcart2
End Function
Function AddNewItemLine(V,ARYcart2)
ARYcart2(iCount,1) = V
ARYcart2(iCount,2) = 1
AddNewItemLine = ARYcart2
iCount = iCount + 1
End Function
Function TagRowForDeletion(R,ARYcart2)
For comp = 0 to 50
If ARYcart2(comp,1) = R then
ARYcart2(comp,1) = ""
ARYcart2(comp,2) = ""
iCount = iCount - 1
end if
next
TagRowForDeletion = ARYcart2
End Function
Function SquashOutSpaces(ARYcart2)
For comp = 0 to 49
If ARYcart2(comp,2) = "" then
ARYcart2(comp,1) = ARYcart2(comp + 1,1)
ARYcart2(comp,2) = ARYcart2(comp + 1,2)
ARYcart2(comp + 1,1) = ""
ARYcart2(comp + 1,2) = ""
end if
next
SquashOutSpaces = ARYcart2
End Function
duplicate = 0
thispage="basket"
ARYcart2=ARYcart
V = Request.QueryString("V")
if V = "" then v = "refresh"
If request("submit")="Apply changes" then
for tt = 1 to iCount
ARYcart2(tt-1,2) = (Request.querystring("T" & tt))
if Not IsNumeric(ARYcart2(tt-1,2)) then
ARYcart2(tt-1,2) = ""
iCount = iCount - 1
end if
if ARYcart2(tt-1,2) = "0" then
ARYcart2(tt-1,2) = ""
iCount = iCount - 1
end if
If IsNumeric(ARYcart2(tt-1,2)) then
ARYcart2(tt-1,2) = Int(ARYcart2(tt-1,2))
If ARYcart2(tt-1,2) < 0 then
ARYcart2(tt-1,2) = ""
iCount = iCount - 1
end if
end if
next
end if
If V <> "refresh" and V <> "remove" then
ARYcart2 = AddToExistingItem(V,ARYcart2)
If duplicate = 0 then
ARYcart2 = AddNewItemLine(V,ARYcart2)
end if
end if
If V = "remove" then
R = request("R")
ARYcart2 = TagRowForDeletion(R,ARYcart2)
end if
For y = 1 to 50
ARYcart2 = SquashOutSpaces(ARYcart2)
next
'-----------------------------------------------
'WRITE BASKET CONTENTS TO A COOKIE
'-----------------------------------------------
%>
<%
'-----------------------------------------------
'REDIRECT TO EMPTY CART PAGE
'-----------------------------------------------
If Request.querystring("Empty")="Empty Cart" then
response.redirect("emptycart.asp")
end if
'-----------------------------------------------
'READ PAGE TEMPLATE FROM FILE
'-----------------------------------------------
'-----------------------------------------------
'WRITE FIRST HALF OF PAGE HTML
'-----------------------------------------------
'response.write(request.cookies(cookiename)("Qty"))
'response.write("
")
'response.write(request.cookies(cookiename)("Items"))
'response.write("
")
'response.write(request.cookies(cookiename)("Icount"))
'response.write("
")
If iCount>0 then
response.write(HTMLtop)
%>