Short version

Having session/cookie problems with webkit browsers (e.g. Chrome) in Magento? Go to System -> Configuration -> Web -> Session Cookie Management and set “Use HTTP Only” to no. Have fun.

Long version

Recently I’ve to work a lot with Magento, which is indeed a very nice webshop solution once you’ve gotten over this huge API and how themes etc. work.

But there was one problem driving me nuts. It started with me not being able to log into the backend. It worked in Firefox, thus it was a minor problem until today. I needed to store some information in the session using Magentos API

Mage::getSingleton('core/session')->setImageData($imgData);

But no matter what I tried,

Mage::getSingleton('core/session')->getImageData();

always gave me NULL instead of the data I expected. Ok, time is limited and cookies will work for the temporarily stuff too. So, same game, but with cookies instead of session:

Setting stuff:

Mage::getModel('core/cookie')->set('imageData', $imgData);

Reading stuff:

Mage::getModel('core/cookie')->get('imageData');

Same result: NULL

Magento session settings

Magento session cookie settings (german)

This was the moment when I realized that this behaviour was linked to my problem not being able to log into the backend using Chrome. Long story short, yes it was!
Magento has this place where you can set your settings for cookies System -> Configuration -> Web -> Session Cookie Management or in german System -> Konfiguration -> Web -> Sitzungscookie Verwaltung). If you read the settings for this page up, you’ll find that these settings are directly linked to PHPs setcookie-function. And precisely there (screenshot in german) is the setting “Use HTTP Only” which is, for some reason, set to “yes” by default. You already guess it, one browser engine currently doesn’t support this feature, it’s webkit. Thus change this setting to “no” and for some magical reason you’ll be able to login and work with sessions in Chrome.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2011 Galeon's Howlingwolf Suffusion theme by Sayontan Sinha
WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera