How to set multiple websites with multiple store views in Magento

Featured Image

If you work with Magento, sooner or later you will end up needing multiple websites that have
multiple languages.
Most of you know this, but I hope someone will still find this post useful.

There are few ways of doing same thing, but in my experience way I’m going to present now causes
less problems even though it is less automatic than some other ways.

Let’s say we want 2 websites and 2 languages for each site.

Here’s procedure:

In admin panel, go to System->Configuration and click on “Manage Stores”
Click on “Main Website” to change it’s name to “Website 1″ or however you want to call it. (I’ll call mine “Website 1″ for the purposes of this article).
In “code” field there, write something like “website_1″.

Do same for “Main Website Store”. Call it “Website store 1″.

And guess what… do same for “Default Store View” that you can find on same interface.
How to call it?
Hm… I’ll call mine “English Store View”
I’ll write “english_store_view_website_1″ in “code” field there.

Ok, let’s go make second one…
Add website named “Website 2″ with code “website_2″.
Add store called “Website store 2″ and assign it to Website 2 that you can chose from dropdown.
Add new store view called “English Store View” with code “english_store_view_website_2″ and
assign it to “Website 2″ that you can find in dropdown.

By now you should have 2 websites with 1 language each.

Add two more store views.
Call first “German Store View” with code “german_store_view_website_1″.
Call second “German Store View” with code “german_store_view_website_2″.
Assign them to corresponding websites.

Let’s see what we have at this moment:

1) a) Website 1 (code: website_1) – Website Store 1 English Store View (code: english_store_view_website_1)
b) Website 1 (code: website_1) – Website Store 1German Store View (code: german_store_view_website_1)

2) a) Website 2 (code: website_2) – Website Store 2 English Store View (code: english_store_view_website_2)
b) Website 2 (code: website_2) – Website Store 2German Store View (code: german_store_view_website_2)

Of course, I didn’t mentioned that you will need to chose root category for your stores, do what ever you like there.

Ok, let’s say we want url to be handled this way:
1) http://www.yourdomain.com/website_1
2) http://www.yourdomain.com/website_2

In your Magento installation directory, make 2 directories called “website_1″ and “website_2″
Copy .htacces and index.php from your root directory in each of those new directories.

In .htaccess search for “RewriteBase /” line and replace it with “RewriteBase /website_1/” in first directory, and
search for “RewriteBase /” line and replace it with “RewriteBase /website_2/” in second directory.

In both directories open index.php and change “$compilerConfig = ‘includes/config.php';” to
$compilerConfig = ‘../includes/config.php';

Change $mageFilename = ‘app/Mage.php'; to $mageFilename = ‘../app/Mage.php';

In same file make sure to edit Mage::run() function for each site:

Mage::run(‘website_1′, ‘website’);
Mage::run(‘website_2′, ‘website’);

Go to System->Configuration and select Current Configuration Scope: Website 1

Set absolute paths to your skin, js and  media directories and set Base URL = http://www.yourdomain.com/website_1  (do that for website_2 too)

Now use this dirty way to switch between websites :)
http://inchoo.net/ecommerce/magento-snippet-for-switching-between-websites/

Since there is much to say about this subject, feel free to ask questions and I’ll try to answer them asap.

Interested in hiring us?

Have a chat with us. You would be surprised how small changes can make your business even more successful.


About Tomas Novoselic

Team Leader/Backend Developer

At Inchoo, Tomas is a Team Leader and Certified Magento Developer who handles Magento modifications at any level. He also works closely with clients on Magento projects of any size and difficulty.

Read more posts by Tomas / Visit Tomas's profile

105 comments

  1. Uhm… my question is: I have 1 website, with N different stores (a main website and N – 1 stores which display a subset of categories/products of the main website), each store has 4 languages.
    So, let’s say I have STORE_MAIN and STORE_SUB_1, and each store has VIEW_ENG, VIEW_FRA, VIEW_DEU. Now, on STORE_MAIN.VIEW_FRA I can see my products and categories translated into French, but when I switch to STORE_SUB_1.VIEW_FRA, products are still in plain English. I assume it’s the way Magento handles Store/View, but it makes product managament damn hard if for any product I have to change the French translation N times on any VIEW_FRA of each store. I’m pretty sure I’m missing something obvious and I’d be glad if someone out there can help me!

  2. I’m trying to add a different language for my store for a week now… But I still have a problem and I don’t know what to do anymore.
    I have one website, one store and I want two languages (the default is Dutch). I want to add an English version with the same products. When I go to the “Manage” store part, the English store view is visible and enabled. But when I go to Admin > Configuration and I want to go to the English store view, there’s nothing there in the dropdown menu of the Current Configuration Scope, only the default config and the Default Store View (the dutch one). Also when I’m trying to change the name of the Dutch one, it looks like Magento only updates it in “Manage Stores” and not anywhere else. I’m desperate right now.

    Reindex or cache doesn’t work… Already tried that. The default config option in Web > URL options > Auto-redirect to Base URL is set to “No”. Can anyone help me??!!!

  3. I am also trying to do what Felix is. Is there any way to link store views with the same store code perhaps and update the descriptions across all storeviews?

    My store setup:

    Website
    Store
    Store Views

    UK
    UK Company
    – English
    – French
    – German
    – Spanish

    US
    US Company
    – English
    – French
    – German
    – Spanish

    EU
    EU Company
    – English
    – French
    – German
    – Spanish

    Hopefully someone can point me in the right direction.

  4. Hi All.
    I have two websites.
    1) International
    2) Us

    Each website had two store view (langauge)
    1.a International_franch
    1.b International_english

    2.a Us_franch
    2.b Us_english

    So, I have one question. How can do, that product attributes were the same values for International_franch and Us_franch websites. I want change product name or product description for two franch store views one time. Can I do that?

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.