6

Please note that it's not another "how to setup multistore". I've read other questions and it seems that my problem is not described.

Following are not answering my question:

I think this question describes the same issue but the answer is kind of workaround Separate store view which reverts back to the default store view

I want to have different store views with different domains. I've created all store views like below:

START OF STANDARD SETUP, NOTHING FANCY, YOU CAN SKIP READING THIS

base
---- store
-------- polish (default)
-------- german
-------- ...

And I've set web_[un]secure_base_url for each and put them in index.php.

switch ($_SERVER['HTTP_HOST']) {
    case 'polishstore.pl':
        $mageRunCode = 'polish';
        $mageRunType = 'store';
        break;
    case 'germanstore.de':
        $mageRunCode = 'german';
        $mageRunType = 'store';
        break;
    // ...
    default:
        $mageRunCode = 'polish';
        $mageRunType = 'store';
}

Note that I've also set in configuration:

  • Add Store Code to Urls: No
  • Auto-redirect to Base URL: No

END OF STANDARD SETUP, NOTHING FANCY

Description of the problem

It works pretty good, but I faced some issues:

  1. When going to http://polishstore.pl/?___store=german it sets cookie store=german and loads german store. From now http://polishstore.pl/ loads incorrectly german store.
  2. When going to http://germanstore.de/?___store=polish it doesn't set cookie store because this store view is default. But it loads polish store. Consecutive visits without ___store loads correctly german store.

    // app/code/core/Mage/Core/Model/App.php:562
    if ($store->getWebsite()->getDefaultStore()->getId() == $store->getId()) {
        $this->getCookie()->delete(Mage_Core_Model_Store::COOKIE_NAME);
    }
    
  3. In such situation it is not possible to access polish store anymore, because of cookie. Helps only deleting that cookie or accessing http://polishstore.pl/?___store=polish.

Alternative scenarios that I've tried

Please note that setting Auto-redirect to Base URL to Yes doesn't help, because then it works as described below:

  1. http://polishstore.pl/?___store=german -> http://germanstore.de cookie store=german
  2. http://germanstore.de/?___store=polish -> http://polishstore.pl no cookie -> http://germanstore.de (because of cookie from step 1)

I would like to make it that domain name tells which store view to load, no matter if cookie is set. It may be that the parameter ___store overrides it but it's not required.

Possible soultions

  1. Delete cookie store or don't set it at all. Deleting cookie in index.php is not working correctly, it works on the second pageload.
  2. Ignore ___store parameter. Use only domain names to determine which store to load.

In both situations it is needed to modify Mage_Core_Model_App (copy it to local). Maybe you have better idea. Please comment or post your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.