0

For some reason people can't put things in their cart, the issue is fixed once you clear your cookies. Problem is: we're getting reports from a lot of customers that they can't add things to their cart. Is there any way to change/update/delete the cookie for everyone?

We're running around with our hair on fire, please help.

Running Magento ver. 1.9.3.1

URL: https://6dsportsnutrition.com/shop/

2

This issue come due to the cookie problem, not in browser but in Magento itself.

As per default Magento, default cookie’s lifetime is set to 3600 (1 hour).

But if the end users computer time runs ahead of server’s time, 
then 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 issue, 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 the admin panel:

Sytem -> Configuration -> Web -> Session and Cookie Management Set cookie lifetime to 86400 and save

Functionality will work as expected.

If still you are facing the issue then check if there are two cookies are setting with same name: one for domainname.com and another for www.domainname.com.

then need to change the cookie domain to www.domainname.com in Admin cookie settings, So that 2nd cookie disappeared and it will works as expected.

7
  • Thanks for answering! We already tried changing the cookie value to 1 day, but still the cart remains empty, even if I restart the browser.
    – troldog
    May 28 '18 at 11:23
  • Try to set cookie lifetime to 0, so that cookie will only expire when the user’s browser is closed. May 28 '18 at 11:24
  • I set it to 0 and unfortunately still no change..
    – troldog
    May 28 '18 at 11:26
  • is there multiple cookie for same name ? May 28 '18 at 11:28
  • Not to my knowledge, how do you check for this? i.imgur.com/MI98peg.png (I put it back at this)
    – troldog
    May 28 '18 at 11:30
0

You can simply change adminhtml cookie name for subdomains.

Two changes in file app/code/core/Mage/Core/Controller/Varien/Action.php.

In function preDispatch change lines

/** @var $session Mage_Core_Model_Session */
$session = Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();

to

$namespace = $this->_sessionNamespace.($_SERVER['SERVER_NAME']=='subdomain.example.com'?'_subdomain':'');
/** @var $session Mage_Core_Model_Session */
$session = Mage::getSingleton('core/session', array('name' => $namespace))->start();

In function setRedirectWithCookieCheck change

/** @var $session Mage_Core_Model_Session */
session = Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace));

to

$namespace = $this->_sessionNamespace.($_SERVER['SERVER_NAME']=='subdomain.example.com'?'_subdomain':'');
/** @var $session Mage_Core_Model_Session */
$session = Mage::getSingleton('core/session', array('name' => $namespace));

And after that search for text

Mage::getSingleton('core/session', array('name' => 'adminhtml'));

in all files and replace it with

Mage::getSingleton('core/session', array('name' => 'adminhtml'.($_SERVER['SERVER_NAME']=='subdomain.example.com'?'_subdomain':'')));

if any occurances would be found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.