<% CONST CARTPID=0 CONST CARTPNAME=1 CONST CARTPPRICE=2 CONST CARTPQUANTITY=3 Dim orderTotal, i, localCart, errMsg fromurl=Request.ServerVariables("HTTP_REFERER") orderTotal = 0 localCart = Session("cart") Session("cartempty") = True If Not IsArray(localCart) Then ReDim localCart(4,20) errMsg = "

Your cart is empty.  Would you like to shopping?  Click here !!

" Session("cartempty") = True End If For i = 0 To UBound(localCart, 2) If localCart(CARTPID, i) <> "" Then errMsg = "" Session("cartempty") = False Exit For End If errMsg = "

Your cart is empty.  Would you like to continue shopping?  Click here !!

" Session("cartempty") = True session.abandon Next If errMsg = "" Then %>
<% For i = 0 To Ubound(localCart,2) If localCart(CARTPID,i) <> "" Then orderTotal = orderTotal + (localCart(CARTPPRICE,i) * CInt(localCart(CARTPQUANTITY,i))) %> <% End If Next %> <% session("ordertotal")=ordertotal Session("cart") = localCart %>
Delete Product Quantity Price
<%=localCart(CARTPNAME,i)%> <%session("localCart(CARTPNAME,i)")=localCart(CARTPNAME,i)%>   <% pricepergood=localCart(CARTPPRICE,i)*localCart(CARTPQUANTITY,i) quantotal=quantotal+CInt(localCart(CARTPQUANTITY,i)) %> <%=FormatNumber(pricepergood,0)%> 
Total  <%=FormatNumber(orderTotal,0)%> Baht
<% Else %> <% =errMsg %> <% End If %>