0

Magento 1.9.0.1

2 store views: dutch & english

Does it automatically show the correct language based on browser settings?

or would I nee to do something like this: http://www.magentocommerce.com/wiki/multi-store_set_up/how_to_automatically_redirect_to_a_store_view_based_on_the_browser_language

Thanks

2

Magento does not have something to redirect users based on location or language to a specific store view.
The code in the link you mentioned should work, in case you have different urls for both languages and both of them are different from the base url.
Here is an example:

Base URL: www.example.com/
En url www.example.com/en/
NL url www.example.com/nl

But if your en url is www.example.com/ and the NL url is www.example.com/nl it won't work. You will get an infinite loop when the user should see the EN language.
To make it work, remove this code:

if ($_SERVER['REQUEST_URI'] === '/') {
    header('Location: '.getStoreForLanguage()->getBaseUrl());
    exit;
}

and replace

Mage::run();

with

Mage::run(getStoreForLanguage()->getCode(), 'store');
  • i guess doing this presents another problem and that is what will happen with online payments return address or not? – carlo Nov 12 '14 at 13:05
  • @carlo. I don't think it should be an issue. But I could be wrong. Good point. I explained how you you can achieve the language redirection but I forgot to mention that I don't agree to this practice. Let the customer choose his language. Don't enforce it. – Marius Nov 12 '14 at 13:13
  • i agree with you Marius – carlo Nov 13 '14 at 19:27
1

Check the following configuration requirements before making any coding changes.

  • Make sure your web server has mod_rewrite enabled.
  • Enable URLrewriting (Admin Panel → System → Configuration → Web → Url Options → Use Web Server Rewrites → Yes).
  • Enable store code in the urls (Admin Panel → System → Configuration → Web → Url Options → Add store code to Urls → Yes).

You have to setup multiple store views from Admin panel.

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.