Hello,
I am constructing a web site for a project, with a shopping cart. Now the shoping cart has 3 main functions: (1) add more products, (2) proceed to checkout and (3) update the quantities of a product. The first two work fine but i am having problems with the last function. Whenever you attempt to update the quantity of a product (whether adding or subtracting), it simply deletes all items in the shopping cart. I would be very grateful if anyone could help with any ideas, heres the code for updating the product quantities:
' Update Shopping Cart Quantities
IF Request( "updateQ" ) <> "" THEN
SET RS = Server.CreateObject( "ADODB.Recordset" )
RS.ActiveConnection = Con
RS.CursorType = adOpenDynamic
RS.LockType = adLockOptimistic
sqlString = "SELECT cart_id, cart_quantity FROM cart " &_
"WHERE cart_userID=" & userID
RS.Open sqlString
WHILE NOT RS.EOF
newQ = TRIM( Request( "pq" & RS( "cart_id" ) ) )
deleteProduct = TRIM( Request( "pq" & RS( "cart_id" ) ) )
IF newQ = "" OR newQ = "0" THEN
RS.Delete
ELSE
IF isNumeric( newQ ) THEN
RS( "cart_quantity" ) = newQ
END IF
END IF
RS.MoveNext
WEND
RS.Close
SET RS = Nothing
END IF
Thank you.