Zen Cart upgrades, particularly 1.3.9, often have changes to how Zen Cart handles sessions. This can cause login issues, add to cart issues, and problems to any other functionality that relies on sessions.
The two most common issues are with adding to cart and logging in. With adding to the cart, even when you click add to cart, the shopping cart still shows it is empty. If you check ADMIN->TOOLS->WHO’S ONLINE you’ll see a new session being created every time. If this is not happening, then sessions probably aren’t the issue. The same thing will happen when trying to login or register, a new session will be created each time but you will not be able to login.
- First, clear your browsers cache, then restart your browser and try again. If this resolved your issue, the problem may only affect those users who have stored data in their browsers from before the upgrade. In time this will sort itself out. However, if on the same browser you continue to have the issue or it happens intermittently, continue reading.
- Next, you should make sure the issue isn’t related to any particular module. Common culprits of session issues can be SEO URLs modules like Simple SEO URLs, Magic SEO URLs, or Ultimate SEO URLs. Try disabling the module, and repeat step 1 above. If this solves the issue, try upgrading to the latest version of the module and trying again. If the latest version doesn’t work, disable the module and contact the author.
- Check ADMIN->CONFIGURATION->SESSIONS->SESSIONS DIRECTORY and make sure the path is correct and matches what you see in your configure.php files.
- In your configure.php files, set the cache methods to “db” and “database”.
- Try overriding the cookie path by uploading the following file to /includes/extra_configures/
- If using Simple SEO URLs, open .htaccess and change
RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L]
RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L,PT]
- This is not a solution, but was noticed in an upgrade performed on a client’s website by a third party. We found that issue could be resolved by changing ADMIN->CONFIGURATION->SESSIONS->RECREATE SESSION to “False”. Normally this should be set to “True” and may mean that the session files were not properly upgraded. In this case, carefully recheck your upgrade.
Regardless of which solution you try, always repeat step 1 after each step. Hopefully one of these will resolve the problem.
If you happen to find another common source for this issue, please post your resolution and we’ll add it to the tutorial.
I recently encountered the same session problem with my shopping cart project. I could’nt able to login. When i try to login it throw security token error. Also i couldn able to add products to my shopping cart.
If u also encounter the same issue then please check with the error logs stored in ‘cache’ folder. So that u ll get some idea about the issue .
so when i checked my error log , it shows that “Failed to write session data”.
I ve pasted the error message below.
“[18-Jan-2013 03:50:22 UTC] PHP Warning: session_start() [function.session-start]: open(/homepages/4/d317970890/htdocs/Demo/zencart/cache/sess_733a467da46acc8419592e40ca54b541, O_RDWR) failed: No such file or directory (2) in /nfs/c09/h01/mnt/132231/domains/demo2.myserver.com/html/zencart/includes/functions/sessions.php on line 114″
This error message indicates that session directory path was wrongly given .
So we need to change the session path in table : “configuration”
I changed the value of SESSION_WRITE_DIRECTORY to “/nfs/c09/h01/mnt/132231/domains/demo2.myserver.com/html/newts4u/includes” in table – “configuration”
“the problem may only affect those users who have stored data in their browsers from before the upgrade. In time this will sort itself out.”
Since customers don’t like errors, they will most likely not put in any effort in clearing their browsers cache when no products are saved into their cart. Hence they will leave without a purchase…
Is there a way to force visitors to clear their cookies? Maybe check if their cookies are corrupted and if so, display a message?