END IF END IF End Function UpdateItem设计: Function UpdateItem(ID, Qty) mudCart = Session("Cart")
FOR i = LBound(mudCart) TO UBound(mudCart) IF mudCart(i,0) = ID THEN mudCart(i,1) = Qty Session("cart")=mudCart Exit Function END IF NEXT End Function ViewItem设计: Function ViewItem() mudCart=Session("Cart") IF isArray(mudCart) THEN %$#@62; $#@60;table$#@62; $#@60;tr$#@62; $#@60;td$#@62;Item Name$#@60;/td$#@62; $#@60;td$#@62;Item Quantity$#@60;/td$#@62; $#@60;td$#@62;$#@60;/td$#@62; $#@60;/tr$#@62; $#@60;% FOR i = LBound(mudCart) TO UBound(mudCart) IF mudCart(i,0) $#@60;$#@62; "" THEN %$#@62; $#@60;tr$#@62; $#@60;td$#@62;$#@60;%=%$#@62;$#@60;/td$#@62; $#@60;% Response.Write "Item ID: " & mudCart(i,0) & "$#@60;--" Response.Write "$#@60;BR$#@62;" Response.Write "Item Qty: " & mudCart(i,1) & "$#@60;--" Response.Write "$#@60;BR$#@62;" END IF NEXT ELSEIF isArray(mudCart) = False THEN Response.Write "No item in your cart!" Response.Write "$#@60;BR$#@62;" Response.Write "Y don’t you do shop!" END IF End Function RemoveItem(ID)设计: Function RemoveItem(ID) mudCart=Session("Cart") ’Find the Postion / Index of given ID. For i = LBound(mudCart) TO Ubound(mudCart) IF mudCart(i,0) = ID THEN Pos=i Exit For END IF Next ’Delete Process... FOR i = Pos TO UBound(mudCart) - 1 IF Not mudCart(i,0) = "" THEN mudCart(i,0) = mudCart(i+1,0) END IF Next End Function End Class REM 结束类CartKit的定义 |