Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shopping cart problem

Status
Not open for further replies.

havoc33

Technical User
Dec 3, 2003
16
NO
Hi, I been trying to get this shopping cart to work all week. Whenever I put an item in the basket I get an error msg: "Your browser does not enable cookies". But my browser DOES enable cookies. Here's the first half of the addprod.asp page:

Dim prodid, quantity, arrCart, scartItem
prodid = Request.Form("fproductid")
quantity = Request.Form("fquantity")
arrCart = Session("MyCart")
scartItem = Session("cartItem")

If scartItem = "" Then
Response.Redirect "error.asp?msg=" & Server.URLEncode ("We noticed you do not accept cookies. Please enable cookies to shop.")
else
if quantity <> "" AND quantity < 1 then
Response.Redirect "error.asp?msg=" & Server.URLEncode ("Please enter at least 1 as number of items you wish to order.")
end if
End If

If prodid <> "" Then
call addToCart()
Else
Dim strAction
strAction = UCase(Left(Request.Form("action"),5))
Select Case strAction
Case "CONTI" 'continue shopping
Response.Redirect "Default.asp"
Case "RECAL" 'recalculate
call recalculateCart()
Case "PROCE" 'proceed to checkout
Response.Redirect "customer.asp"
End Select
'end if for updating or inserting new item in Cart
End If

sub addToCart()
If scartItem < maxCartItems Then
scartItem = scartItem + 1
End If
Session("cartItem") = scartItem
dim rsItem, sqlProductInfo
sqlProductInfo = "SELECT * FROM products WHERE (products.catalogID=" & prodid & ")"

'open connection - returns dbc as Active connection
call openConn()
Set rsItem = Server.CreateObject("ADODB.Recordset")
rsItem.Open sqlProductInfo, dbc, adOpenForwardOnly,adLockReadOnly,adCmdText
If Not rsItem.EOF Then
arrCart(cProductid,scartItem) = rsItem("catalogID")
arrCart(cProductCode,scartItem) = rsItem("ccode")
arrCart(cProductname,scartItem) = rsItem("cname")
arrCart(cQuantity,scartItem) = CInt(quantity)
arrCart(cUnitPrice,scartItem) = rsItem("cprice")
Session("MyCart") = arrCart
End If
rsItem.Close
set rsItem = nothing
call closeConn()
end sub

Can anyone figure out what's wrong?
 
Nevermind people, problem is solved. I just found out my global.asa file wasn't initiating...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top