1

I have written a custom function to set our MAGERUNCODE based on the accept language and the uri request (beeing /). THis works fine.

Now I have 1 remaining issue. And this is when the customer uses the store switcher and 'forces' to see another language. I understand that the request storeview is then stored in a COOKIE.

Question: how can I grab the storeview from te Magento cookie (after the language switcher was used)

Many thanks, Sean

3
  • stackoverflow.com/questions/26128412/…
    – user2857
    Apr 24, 2015 at 11:21
  • if ($http_cookie ~ 'NAME=VALUE') { ACTION };
    – user2857
    Apr 24, 2015 at 11:32
  • or use map module the same way, to map cookie values to code
    – user2857
    Apr 24, 2015 at 11:46

1 Answer 1

1

We are using the code like below. If the root (/) is requested and a store cookie was not already set, then run getLanguageRunCode and try to find a store matching your language.

The store cookie is acquired through Mage::getModel('core/cookie')->get('store')

Mage::init();
$_storecookie = empty(Mage::getModel('core/cookie')->get('store'));
if ($_SERVER['REQUEST_URI'] === '/' && $_storecookie) {
  $mageRunCode = getLanguageRunCode($mageRunCode);
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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