<% Response.Expires = -1 %> <% Const adOpenKeyset = 1 Const adLockOptimistic = 3 Dim strCartId strCartId = Request("CartId") Dim strItemNum strItemNum = Request("ItemNum") Dim strPage strPage = Request("Page") Dim strPrice strPrice = Request("Price") Dim strOptionSet1 If Request("OptionSet1") <> "" Then strOptionSet1 = Request("OptionSet1") Else strOptionSet1 = 0 End If Dim strOptionSet2 If Request("OptionSet2") <> "" Then strOptionSet2 = Request("OptionSet2") Else strOptionSet2 = 0 End If Dim strOptionSet3 If Request("OptionSet3") <> "" Then strOptionSet3 = Request("OptionSet3") Else strOptionSet3 = 0 End If DIM myCheck, objRSCheck Set objRSCheck = Server.CreateObject("ADODB.Recordset") myCheck = "SELECT * FROM Cart Where CartId = '"& strCartId &"' And ItemNum = '"& strItemNum &"' And Opt1 = '"& strOptionSet1 &"' And Opt2 = '"& strOptionSet2 &"' And Opt3 = '"& strOptionSet3 &"'" objRSCheck.Open myCheck, objConn, 1, 3 Dim strQuantity strQuantity = Request("Quantity") If strQuantity = "" Then strQuantity = "1" Else End If If strPrice <> "" Then strPrice = Request("Price") Else strPrice = "0.00" End If Dim strItemTotal strItemTotal = strPrice * strQuantity Dim strBaseWeight strBaseWeight = Request("Weight") Dim strWeight strWeight = Request("Weight") * strQuantity If objRSCheck.EOF Then DIM objRS Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open "Cart", objConn, 1, 3 objRS.AddNew objRS("CartID") = Request("CartID") objRS("ItemNum") = Request("ItemNum") objRS("Description") = Request("Description") objRS("Download") = Request("Download") objRS("Opt1") = strOptionSet1 objRS("Opt2") = strOptionSet2 objRS("Opt3") = strOptionSet3 objRS("Quantity") = strQuantity objRS("Price") = strPrice objRS("ItemTotal") = strItemTotal objRS("Weight") = strWeight objRS("BaseWeight") = strBaseWeight objRS("Notes") = Request("Notes") objRS.Update Else Dim strUnique strUnique = objRSCheck("ListNum") strQuantity = Request("Quantity") Dim strExistingQuantity strExistingQuantity = objRSCheck("Quantity") Dim strNewQuantity strNewQuantity = CInt(strExistingQuantity) + strQuantity Dim strExistingPrice strExistingPrice = objRSCheck("Price") Dim strNewItemTotal strNewItemTotal = strNewQuantity * strExistingPrice Dim strNewWeight strNewWeight = Request("Weight") * strNewQuantity objConn.Execute "Update Cart Set Quantity = "& strNewQuantity &", ItemTotal = "& strNewItemTotal &", Weight = "& strNewWeight &" Where ListNum = "& strUnique &"" End If Response.Redirect"cart_view.asp?Page=" & strPage %>