Magento: Can’t login/add items in Chrome and IE
Problem: In Chrome and IE, user as well as admin are unable to login as well as add items to cart. In Firefox, everything works fine.
Solution: This is due to the cookie problem, not in browser but in Magento itself. In Magento, by default cookie’s lifetime is set to 3600 (1 hour). But if the end users computer time runs ahead of server’s time, cookies will not get set for magento frontend as well as backend. For example, end user’s computer time is 1 hour forward than server’s time, that means the cookie (holding user’s session id) will expire as soon as user logs in or tries to add an item.
To solve this, set cookie’s lifetime to 86400 (1 day) instead of 1 hour and everything will work as expected. You can also set cookie lifetime to 0, so that cookie will only expire when the user’s browser is closed.
Go to: Magento backend -> Sytem -> Configuration -> Web -> Session and Cookie Management
Set cookie lifetime to 86400 and save. Everything will work as expected now.
28 Comments
Leave a comment
Welcome to my Blog
Certifications
Honor
Recognition
Contributions
Categories
- Apache (2)
- ChatGPT (1)
- Domain name (2)
- eCommerce (2)
- htaccess (1)
- Humor (3)
- Instagram API (1)
- jQuery (4)
- JSON (1)
- Linux (10)
- Magento (142)
- Magento admin (58)
- Magento Certification (5)
- Magento error (13)
- Magento frontend (68)
- Magento Imagine (2)
- Magento Interview (5)
- Magento Master (2)
- Magento2 (10)
- Mobile (1)
- MySQL (7)
- OpenAI (1)
- OroCRM (2)
- Performance (2)
- PHP (8)
- Prototype JS (3)
- Security (4)
- Wordpress (3)
- XML (2)
Thanks. Really help me a lot.
Just wanted to say thanks for saving me from a major headache! This was exactly what I needed to know.
Thanks a lot mate, just what I needed!
Excellent thanks dude, I had tried a number of other solutions for this problem – as I was running in a VM and pausing it every night it fell behind by around 8 hours.
I didn’t change the value above instead just resynced the time on the server using “ntpupdate pool.ntp.org” and it started working again.
Thanks for pointing me in the right direction though!
I had the same problem with our VM and we use url as vm-magento. when i changed it to IP it worked well without any other changes. We have EE 1.12.0.0
Hi,
I had same problem….
I resolved this by using another way….
Reason: If your host disk space is limited for your plan and after some days if it exceeds/full then cookie and session have no space to store…so this kind issue can occurs…
Solution: Clean up space…remove unnecessary data ….
Thanks
PRaful
Very useful. Thanks Kalpesh.
Not working.
its not working….help me..
It’s working for me. Thank you.
Thanks, dude! Saved my day!
But very shortsighted design decision from the Magento devs.
Thanks frnd , it was really very helpfull .
2nd Solutions:
Go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.
Find the code:
$cookieParams = array(
‘lifetime’ => $cookie->getLifetime(),
‘path’ => $cookie->getPath(),
‘domain’ => $cookie->getConfigDomain(),
‘secure’ => $cookie->isSecure(),
‘httponly’ => $cookie->getHttponly()
);
and replace with
$cookieParams = array(
‘lifetime’ => $cookie->getLifetime(),
‘path’ => $cookie->getPath()/*,
‘domain’ => $cookie->getConfigDomain(),
‘secure’ => $cookie->isSecure(),
‘httponly’ => $cookie->getHttponly()*/
);
save the file ,, It must works for all browsers
Thanks.it is worked for me. Good Job, thanks once agian to azhar farooq
Seems to have worked for us and resolved a very upsetting problem that was costing us lost revenue and unhappy customers. Thanks Kalpesh!!
Login is not working anywhere in version 1.6.0.
Can anybody help?
… [Trackback]…
[…] Informations on that Topic: ka.lpe.sh/2011/07/09/magento-cant-loginadd-items-in-chrome-and-ie/ […]…
This didn’t help, I also tried Azhar’s solution with no luck. Any other ideas?
Thanks a lot! I’ve been looking all day for a solution and finally I found something that works even on magento 1.4.1.1 … You’re great!
Thanks a lot for this. It was very helpful.
… [Trackback]…
[…] There you will find 57684 more Infos: ka.lpe.sh/2011/07/09/magento-cant-loginadd-items-in-chrome-and-ie/ […]…
Thanks so much mate I nearly had a heart attack when a customer phoned me about this on his Magento site and I had no idea what to do to fix it. This fixed the issue.
Thanks for your help,
Keith
Thanks! I was already pulling my hair out because of this. A little sidenote: I also had to set HTTP only to No in my admin for it to work (on my localhost running Vagrant)
I tried everything didn’t work UNTIl I read what Giel did which was turn the HTTP only to NO. Worked perfect!
Saved me, Magento 1.6.1, changed cookie lifetime to 86400 and was then able to login/add products using IE.
I had no problems with Chrome or FF.
thanks u save me u r so nice man
Thanks
In Case, that you dont see any cookie named “frontend” or “adminhtml”, wenn you reload the page, the magento cookie wasnt set. In my case I have a wrong cookie_domain. I used “null” instead of “NULL”.
As I set my cookie_domain to NULL in core_config_data, the problem was solved