0

I have a fairly simple question which I thought would be easy to setup, but is proving difficult.

I have a Magento installation, and I want it to have 2 websites, with two languages on each. Then wehen I go on the tennis UK domain it loads the UK store. If I go on the French domain it loads the French store.

This is how it is working now (INCORRECT):

Tennis UK (website)
Tennis UK (store & store views)

Tennis FR (website)
Tennis FR (store & store views)

Volleyball UK (website)
Volleyball UK (store & store views)

Volleyball FR (website)
Volleyball FR (store & store views)

This is how I'd prefer it to work (CORRECT):

Tennis (website)
Tennis UK / Tennis FR (stores & store views)

Volleyball (website)
Volleyball UK / Volleyball FR (stores & store views)

In the htaccess I am running a script to run the correct website, but I thought that I should also be able to run a store code if needed, like this:

SetEnvIf Host www\.tennisukdomain\.co.uk MAGE_RUN_CODE=tennis_uk
SetEnvIf Host www\.tennisukdomain\.co.uk MAGE_RUN_TYPE=store
SetEnvIf Host ^tennisukdomain\.co.uk MAGE_RUN_CODE=tennis_uk
SetEnvIf Host ^tennisukdomain\.co.uk MAGE_RUN_TYPE=store

But this is not working for some reason. Does anybody know the correct way to get this working. By loading a store view instead of a website each time it will cut down on the amount of configuration I have to do in the admin.

Any help much appreciated.

4

1 回答 1

0

你可以通过代码来实现。例如:

索引.php

$host = explode(':', $_SERVER['HTTP_HOST']);
$dname = substr($host[0], -3,3);

switch ($dname) {
case '.uk':
   $store = 'tennis_uk';
   break;
case '.fr':
   $store = 'tennis_uk';
   break;
default:
   $store = '';
}

Mage::run($store); 
于 2012-04-25T06:30:11.823 回答