Posted - 05/31/2024 : 05:29:47
Hello,
We just launched yesterday with version 7.6.4 and had some edge case 500 errors on cart.asp
The errors happened only for some logged in users and it happened when they clicked the checkout button, moving to step 2 of the cart.
We enabled the below skip as well as error handling which is now commented out and it said cval is null. It allowed the people to pass through to checkout step 2 and complete orders, but would the cookie not working here cause any potential issues? I do not even see cookies here in the older versions of ECT.
I am guessing it is one of the 3 cookies made in the below section which looks like it pulls from an abandoned cart. I also am wondering if this may be a database schema issue as we just moved from a very very old unknown version to this version.
Any idea what may have caused the cval to be passed in as null? Also, would it have been one of those 3 cookies as the issue? The other 7 calls looked to be different areas of the cart.
sub setacookie(cname, cval, cdays) On Error Resume Next ' Enable error handling
' Check if cname is a string and not empty if IsNull(cname) or cname = "" then ' Response.Write("Error: cname is null or empty.<br>") Exit Sub end if
' Check if cval is not null if IsNull(cval) then ' Response.Write("Error: cval is null.<br>") Exit Sub end if
' Check if cdays is a numeric value if Not IsNumeric(cdays) then ' Response.Write("Error: cdays is not a number.<br>") Exit Sub end if
' Set the cookie response.cookies(cname) = cval if cdays <> 0 then response.cookies(cname).expires = Date() + cdays if request.servervariables("HTTPS") = "on" then response.cookies(cname).secure = TRUE
' Check for errors and handle them if Err.Number <> 0 then ' Response.Write("An error occurred: " & Err.Description & "<br>") Err.Clear ' Clear the error end if
On Error GoTo 0 ' Disable error handling end sub
if is_numeric(getget("acartid")) AND getget("acarthash")<>"" then sSQL="SELECT aceID FROM abandonedcartemail WHERE aceOrderID=" & getget("acartid") & " AND aceKey='" & escape_string(getget("acarthash")) & "'" rs.open sSQL,cnn,0,1 if NOT rs.EOF then cnn.execute("UPDATE cart SET cartSessionID='" & thesessionid & "' WHERE cartOrderID=" & getget("acartid") & " AND cartCompleted=0") cnn.execute("UPDATE orders SET ordSessionID='" & thesessionid & "' WHERE ordID=" & getget("acartid") & " AND ordStatus=2 AND ordAuthNumber=''") call setacookie("ectordid",getget("acartid"),0) call setacookie("ectsessid",thesessionid,0) call setacookie("ecthash",sha256(getget("acartid")&thesessionid&adminSecret),0) end if rs.close end if
|