0

I have two stores 'English' and 'Arabic'. I have set 'Arabic' store as default store and first time when I open browser 'Arabic' store opens automatically but when I change the store from 'Arabic' to 'English' and close the browser and then open the website again it opens 'English' store.

I want that whenever the website is opened after closing browser the default browser should be always 'Arabic'.

Thank you

  • This is normal, this info is set in your cookie in "store" key. – Jonathan Ribas Feb 28 '17 at 12:30
2

In the index.php file there is following code:

Mage::run($mageRunCode, $mageRunType);

So you can define a runcode (for example a store code) and a runtype (for example store).

Mage::run('arabic', 'store');

Of course you have to check if the request url is empty so you don't redirect when a user has already chosen a language:

if ($_SERVER['REQUEST_URI'] === '/') {
    Mage::run('arabic', 'store');
}

You can do the same in the .htaccess file, if you use Apache (i didn't work it out completely):

SetEnvIf MAGE_RUN_CODE=arabic
SetEnvIf MAGE_RUN_TYPE=store
  • 1
    Editing core files is not a good practice, better use an observer on controller_action_predispatch event and do the logic there. – Jonathan Ribas Feb 28 '17 at 13:06
  • Completely true. It would be better to do it in the .htaccess file or like you say with an observer. And observer is better because it doesn't depend on the server technology – Stijn Duynslaeger - Echron Feb 28 '17 at 13:55

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.