These are the basic instructions for setting up a Magento multi-store, where separate store fronts share the same back end.
Root category
- In the Magento admin panel click on Catalogue → Manage categories
- Click the Add Root Category button
- Pick an appropriate name, e.g. Wholesale, and select Yes for "Is Active"
- Click on the "Display Settings" tab and select Yes for ""Is Anchor"
- Save the category
Website, store & view
- Go to System → Manage Stores
- Click "Create Website"
- Enter and note the name and code, e.g. wholesale.domain.com.au and wholesale, and click Save
- Click "Create Store"
- Select the new site in the drop-down box, choose a name, and click Save
- Click "Create Store View"
- Choose the appropriate store, enter values for Name and Code, e.g. Default wholesale view and wholesale_default, select Enabled under Status, and click Save
Configuration
- Go to System → Configuration
- Change the Current Configuration Scope to the website name, e.g. "wholesale.domain.com.au"
- Click on Web under General on the left navigation
- Under each of Secure and Unsecure, uncheck the Use Default checkbox and enter the URLs the new store will use - in this example wholesale.domain.com.au and click Save Config
Switching store based on URL
- Park the new domain in cPanel, or create a new name virtual host pointing to the same webroot / point the domain at the dedicated IP on a server without a control panel
- Edit index.php and add
switch($_SERVER['HTTP_HOST']) {
case 'wholesale.domain.com.au':
case 'www.wholesale.domain.com.au':
$mageRunCode = 'wholesale';
$mageRunType = 'website';
break;
}
before
Mage::run($mageRunCode, $mageRunType);
where wholesale is the code used when creating the website above.