MASSMEDIUMS - Responsive Web Design Cincinnati MASSMEDIUMS - Responsive Web Design Cincinnati

Login to Magento & Add Items with Google Chrome

Have you ever found yourself running into this problem? While using Google Chrome and Internet Explorer all your users, as well as your administrators, are all unable to login to a site and are, in turn, unable to add items to the cart. However, in Firefox, everything works fine and there are no obstacles or problems?

This is due to the cookie problem... not the cookies in your browser, but your cookies in Magento itself. This is because in Magento, by default, a cookie’s lifetime is automatically 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 front-end 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.

The solution

We have found these solutions to be quite helpful when we need to either fix or add items to Google Chrome with Magento.

First, you must reset your cookie’s lifetime to 86400 (24 hours) instead of 3600 (1 hour). You can also set cookie lifetime to 0, so that cookies will only expire when a user’s browser is closed.

Here are the steps to perform this task.

  1. Install Magento and login using Opera browser
  2. Login to Magento backend
  3. Go to System > Configuration > Web > Session and Cookie Management
  4. Set cookie lifetime value to 86400 (24 hours) and then click save

Everything should now work as expected. If this does not work, modify the following file:

app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory

Look for the following code:

session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);

And replace with

session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

Or look for the following code

// session cookie params
$cookieParams = array(
    'lifetime' => $cookie->getLifetime(),
    'path'     => $cookie->getPath(),
    'domain'   => $cookie->getConfigDomain(),
    'secure'   => $cookie->isSecure(),
    'httponly' => $cookie->getHttponly()
);

And replace with

// session cookie params
$cookieParams = array(
    'lifetime' => $cookie->getLifetime(),
    'path'     => $cookie->getPath()
//  'domain'   => $cookie->getConfigDomain(),
//  'secure'   => $cookie->isSecure(),
//  'httponly' => $cookie->getHttponly()
);

After this save the file and the problem should have been solved.

Ready to get started? Let us take your website to the next level. LET'S TALK
MASSMEDIUMS has been essential in the growth of our company, delivering high-impact marketing tools and a first-rate web presence

, VP, Ziegler Practice Transitions