Let's see how to create multiple storefronts using Magento.
Firstly it is important to understand the following structure:
Global | Website | Store | Store View
One of the advanced features of Magento’s is that it allows for management of multiple websites and stores within one installation. Magento has a great system to support the Global, Website, Store and Store View structure.
Below I have given a brief definition of the terms used in the structure:
Global: The installation as a whole.
Website: Websites are the ‘parents’ of stores, and usually consist of one or more stores. Websites can be set up to share customer data.
Store (or store view group): Stores are the ‘children’ of websites. All products and categories are managed at store level. A root category is configured for each store view group, allowing multiple stores under the same website to have different catalog structures.
Store View: A store needs one or more store views to be browse-able in the front-end. The catalog structure per store view will always be the same, it simply allows for multiple presentations of the data in the front-end. The majority of implementations use store views to allow customers to switch between two or more languages.
Example of a Magento multiple store view structure (taken from magentocommerce.com)
Now let's talk through the implementation process.
For this implementation, we have three web sites. Each of these websites has a store. In addition, each of the stores will be available in multiple languages.
This scenario is displayed in the diagram below.
Now let’s implement this scenario.
Step 1: Creating root categories for store views
· Access the Magento Admin Panel.
NOTE: If you want your stores to share the same catalog and products skip to Step 2.
· In the top menu, go to Catalog > Manage Categories.
· Click ‘Add Root Category’.
· In ‘Name’ enter the store name (Store One, Store Two and Store Three etc.).
· In ‘Active’ select Yes.
· Click the ‘Display Settings’ tab, in ‘Anchor’ select Yes, and then ‘Save Category’.
After creating the root categories it should look like the above.
Step 2 – Manage store section
· Go to System > Manage Stores.
We are now creating the websites
· Click on the ‘Create Website’ in the top right hand corner.
· In the ‘Name’ field, enter website name e.g. ‘Web Site One’.
· In the Code field, enter ‘websiteone’.
· We can leave “Sort Order” field blank.
Repeat these steps to create the other two web sites shown in the scenario.
To create the stores
· Click on ‘Create Store’ button in the top right hand corner.
· In the dropdown menu select the website that was created in the previous step.
· Give your store a name. I am just going to use ‘storeone’.
· Now select the Root Category that was created in Step 1.
Repeat these steps in order to create the other two stores shown in the scenario.
Creating Store Views (Creating multi language store fronts).
· Click ‘Create Store View’ in the top right hand corner.
· Select the store in the dropdown.
· Give the store view a name and code.
· Set the status to ‘Enabled’.
· ‘Sort order’ can be left blank.
Repeat these steps for as many language sites as you would like to add.
After following all the above steps the ‘Magento Manage Store’ section should look like the following image.
NOTE: The section highlighted in green shows one website that is setup with the multi store view feature.
Step 3 – Current Configuration Scope
· Click on System > Configuration.
· In the Current Configuration Scope (in the top left corner), select the websites that you just created.
· Then click on the ‘Web’ tab under ‘General’.
· Expand the ‘Unsecure’ and ‘Secure’ accordion menus.
· Next type the website ID into the ‘Base Link URL’ field in ‘Manage Store’. See screenshot below.
· Now we need to create CMS pages for all the websites and assign them under “Default Pages” section as follows.
Step 4 - Separate Directories for Each Store
Now it’s time to create separate directories for each store in your Magento installation root director.
· Create folders for each of your websites.
· Copy the index.php and .htaccess file into your Magento root installation path, and then paste them into the folders you have just created.
· Then open index.php in each of the folders and make the following changes:
Index.php file Modification - 1
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$mageFilename = '../app/Mage.php';
Index.php file Modification - 2
$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
$compilerConfig = '../includes/config.php';
Index.php file Modification - 3
Once this is done and your cache is refreshed you will be able to load your websites.
Once the website is loaded you will be able to switch between the multiple language stores by using the default Magento language switcher.
So there you have it- How to create a multi-storefront on Magento. Creating a multi-storefront is a powerful Magento tool so I hope that you find the steps useful and easy to follow!
Do leave a comment and let us know how useful this post was and where we can improve for next time!