Multiple magento stores and urls on one magento instance.

So you want to run a few stores from one master admin in magento.  Luckily, they make it easy to do. First thing’s first, secure the urls you need for your store.  For my example, I’m gonna use www.evermoremagento.com as the main store and www.substore1.com as the secondary store.

I’m assuming you want to keep the stores pretty seperate.  The reason for this could be that you have two different item types you’re selling, for example shoes on one site and electronics on the other site, so you want the catalog and theme to be seperate, but you own them both, so you want an admin panel that shows you sales of all your stores in one place.    Some people might say this is a bad idea for scalability, but we’re not going to worry about that for this.

Assuming you have www.evermoremagento.com running your main store, the first step is to add a category for your new store.  Go to the categories section (Catalog->Manage Categories) and click “Add Root Category).  Name that category something that makes sense for your store, such as substore one catalog.  Make sure to select Yes for Is Active and Is Anchor.

Next step is to go to manage stores and add a website for the new store.  Set the name and code to something descriptive of the store.  We’ll set ours to Sub-Store for the name and substore for the code.

Now click create store.  Select Sub-Store for the website, substore one catalog for the root category, and enter Main Store for Substore One for the name.

Next is to create the store view for the store.  We’ll call ours SubStore one Main, selecting our store and setting it to enabled.  Then we’ll use substore_view for the code.

Now we need to set the url for our second store.  This is in System->Configuration->Web.  Make sure to set the configuration scope to Sub-Store (the name of the website).  Change the base urls to www.substore1.com.

The final step is to make a change to index.php to load this store if a user comes in through www.substore1.com.  Open up php and look for this line of code.

[code]Mage::run($mageRunCode, $mageRunType);[/code]

…and right before this,  add the following code:

[code]switch($_SERVER[‘HTTP_HOST’]) {
case ‘shoes.com’:
case ‘www.shoes.com’:
$mageRunCode = ‘shoes’;
$mageRunType = ‘website’;
break;
}[/code]

OK, everything’s set now.  If you want, you can change the theme for the second store in System->Configuration->Design, and changing the configuration scope to that of your website.

Leave a Reply

Your email address will not be published. Required fields are marked *