Vp Asp Shopping Cart _best_ May 2026
' Loop to find if product already in cart For i = 0 To UBound(cart) If cart(i, 0) = pid Then cart(i, 3) = cart(i, 3) + qty found = True Exit For End If Next
productID|quantity|price|name^productID2|quantity2|price2|name2^... But a is cleaner. 2. Cart data structure (in Session) On session start ( global.asa ): vp asp shopping cart
(store in Session("Cart") ):
Session("Cart") = cart Response.Redirect("view_cart.asp") %> At checkout, copy cart to database , then clear Session: ' Loop to find if product already in
If Not found Then ReDim Preserve cart(UBound(cart) + 1) cart(UBound(cart)) = Array(pid, pname, price, qty) End If 0) = pid Then cart(i