Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
 All Forums
 Technical
 ASP (Windows server) versions
 Cart Cookie 500 Error
Author « Topic »  

Dermontti
Advanced Member

USA
161 Posts

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

dbdave
ECT Moderator

USA
10379 Posts

Posted - 05/31/2024 :  07:52:32  
Hi, if you are going from a very old version of ect to the latest versions, there was a big change where much of the javascript was moved to an external file.
I suspect you either do not have that in place, or you may not have went into your pages and added the line to reference (call up) the file.
The same with the css file.
More info here - https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=107040

Can you check to be sure all of that is in place?

Thanks,
David

Dermontti
Advanced Member

USA
161 Posts

Posted - 05/31/2024 :  11:43:22  
Hello David,

I have made sure all of that works for sure. None of the cart would functions without the basics.

We have tested the cart functionality for months and like I said this seems to be an edge case.

I provided the error of the cval being null and the likely function calls that would cause the error.

Could someone please look into why a null error might be being thrown? What data is passed in from where? Is it using a new database column that might be set as null by default?

Please advise.

Thanks

dbdave
ECT Moderator

USA
10379 Posts

Posted - 05/31/2024 :  12:10:21  
Hi, There are no issues with cookies.
I'm not sure what you mean by the term "edge case" in this scenario...
Can you post the unmasked "500" error as that will likely reveal the issue?

I have a look at the site in your profile and don't see any errors.
Is this a different site?
If so, can you post a link, or add it to your profile so I can take a look?
You can also click my username and send a message with the URL.

Thanks,
David

Vince
Administrator

42689 Posts

Posted - 06/01/2024 :  03:10:56  
Hi Dermontti
I've added checks for NULL values and invalid "cdays" values in the setacookie() function similar to what you have done. I don't think not setting the cookie is going to cause any issues as it's only for remembering the checkout values, so do you think if we do this and check in a few days that the problems have cleared up?

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Dermontti
Advanced Member

USA
161 Posts

Posted - 06/03/2024 :  04:45:07  
Hello,

Thank you for the prompt response.

It appears as if it has not caused any issues since the null check was added.

However, what checkout values does it save? That sounds important?

Also, if you know which of the cookies is responsible, I can maybe track down the source of the bad data type being passed in.

Thanks

Vince
Administrator

42689 Posts

Posted - 06/04/2024 :  04:52:25  
Hi Dermontti
quote:
However, what checkout values does it save? That sounds important?
It's just saving information so that if the customer goes back through checkout they don't have to fill everything out again.
quote:
Also, if you know which of the cookies is responsible, I can maybe track down the source of the bad data type being passed in.
I'm not really sure to tell the truth but doesn't your debug give the cookie name?

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Dermontti
Advanced Member

USA
161 Posts

Posted - 06/04/2024 :  06:41:03  
Thanks for the additional info.

If you do not think it will be a concern, I will not look into it any further unless an issue arises since it already seems to be an edge case.

Thanks!
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000