% function WISHLIST_exist() if request.cookies("wishlist")<>"" then WISHLIST_exist=true else WISHLIST_exist=false end if end function function WISHLIST_add(productid) 'find a free space for the item nospace=true i=0 while nospace i=i+1 if request.cookies("wishlist") ("item" & cstr(i))="" then nospace=false end if wend response.cookies("wishlist") ("item" & cstr(i))=productid 'update the maxindex if i>cint(request.cookies("wishlist")("maxindex")) then response.cookies("wishlist")("maxindex")=i end if response.cookies("wishlist").expires=now() + 90 end function function WISHLIST_delete(wishproductid) listempty=true 'remove all instances of the product from the wishlist for i=1 to request.cookies("wishlist")("maxindex") if request.cookies("wishlist") ("item" & cstr(i))=wishproductid then response.cookies("wishlist") ("item" & cstr(i))="" end if 'check if the wishlist is completley empty if request.cookies("wishlist") ("item" & cstr(i))<>"" then listempty=false end if next if listempty then 'destroy wishlist response.cookies("wishlist").expires=now() response.cookies("wishlist")="" end if end function function WISHLIST_element(wishproductid) element=false for i=1 to request.cookies("wishlist")("maxindex") if request.cookies("wishlist") ("item" & cstr(i))=cstr(wishproductid) then element=true end if next WISHLIST_element=element end function function WISHLIST_dispaly() sqlcond="" for i=1 to request.cookies("wishlist")("maxindex") if isnumeric(request.cookies("wishlist")("item" & cstr(i))) then sqlcond=sqlcond & " productid=" & request.cookies("wishlist")("item" & cstr(i)) & " or " end if next sql="select * from products where " & sqlcond & " productid<0" set rswish=db.execute(sql) if rswish.eof then WISHLIST_display=false else %>
| ID # | Item | Price | Delete |
| "><%= rswish("productid") %> | "><%= rswish("name") %> |
<% if rswish("saleprice")=0 then %>
<%= cursymbol & formatnumber(rswish("price")) %>
<% else %>
|
">
|