Magento is a web application designed so that other users or developers can add to its capabilities. One of its popular features is the creation and management of multiple store fronts within a single Magento account. This is known as a Magento multi-store. This guide will demonstrate how to do this.

A new store would be known as the ‘child’ store, and you would be linking it to a ‘parent’ store, an existing Magento store you have, ensuring that the application is tightly integrated with your Plesk Panel.

You can do this by making using of SNI. SNI is a relatively new technology and stands for Server Name Indication, allowing you to host multiple SSL certificates on a single IP address. Using SNI we are able to make use of domain aliases (imagine multiple doors to the same location) to simplify the multi-store application. The one problem with this approach is that SNI is not supported for any version of Internet Explorer on Windows XP, meaning users will be unable to access parts of your multi-store if you use this approach.

The requirements

You should note the guide assumes the following:

  • You are currently making use of Plesk Panel 10 or higher on your existing NuBlue hosting solution. At the time of writing this only applies to our VPS and dedicated hosting solutions, but we are planning to make this available on the shared hosting platform.
  • You have an existing Magento store running on your existing hosting solution.

Throughout the following guide we are using the following implementation:

  • Plesk Panel 11
  • PHP 5.3, MySQL 5.1, Apache, nginx
  • Magento 1.7.0.2 (released July 2012)

The scenario

We currently have an existing Magento store, www.tshirts-uk.co.uk, that sells t-shirts within the United Kingdom (NuBlue t-shirts are not yet available, sorry!). We are looking to expand our Magento store to sell t-shirts on an international scale, with plans to expand to the United States and then to parts of the EU should our first foray to foreign shores be successful.

Configure Magento

We first need to configure our existing Magento instance to integrate with our new child store. This can be done directly within your existing Magento Admin Panel. Browse to ‘System’ and ‘Manage Stores’.

magento-config-1

If you have a default Magento configuration, you should see the above store layout. Click on ‘Create Website’, ‘Create Store’ and ‘Create Store View’. As these are somewhat dependant on each other, once all three are created you can go back and link them to each other. E.g. you cannot select the ‘T-Shirts US Store View’ (our new child store) as the ‘Default Store View’ when creating your new store until the Store View has been created.

The following three screenshots should give you an idea on how to configure your new ‘Website’, ‘Store’ and ‘Store View’ correctly.

magento-config-website

magento-config-store

04-magento-config-4

You should now have something that looks like the below screenshot.

magento-config

Our final step for configuring Magento for use with your new child store is to edit the two base URL variables. This is done within your Magento Admin Panel under ‘System’ and ‘Configuration’. Browse to ‘Web’ and under ‘Unsecure’ and ‘Secure’ edit the current base URL, which should presently be set to your parent store, to that of your child store. It is imperative that you leave the trailing slash in place, and that you should note the differences between unsecure (http://) and secure (https://) within your configuration. Once these changes have been made, clear your Magento cache.

magento-base-url

USING SNI

Step one: Create our child store

As Magento should already be configured using the instructions above, we now need to configure our new child store domain within the Plesk Panel. This process involves adding an additional domain to an already existing subscription.

To add an additional domain to an existing subscription within your Plesk Panel, browse to ‘Subscriptions’, select the subscription associated with your existing previous, select ‘Websites & Domains’, scroll down and select ‘Add New Domain’.

Enter the domain of your child store within the ‘Domain name’ text box, and adjust ‘Document root’ from the default value to ‘httpdocs’ (which matches the current value of your parent store).

07-plesk-add-domain

Your configuration should now look something like the above.

Step two: Configure the index.php of your parent store

The final step is to configure your Magento store to display the child store when triggered by an event, which will be when a user enters your domain name into the address bar. This can be done by editing the index.php (the ‘skeleton’ of a website) file associated with your Magento store for the parent domain. This can be done by using the text editor FTP, or within your Plesk Panel using the File Manager tool. We will make use of File Manager, which can be found within your subscription (for the parent domain) under ‘Websites & Domains’ and ‘File Manager’.

Within your index.php file you should append an adaptation of the following directly under ‘umask(0);’

08-plesk-store-run-code

The above screenshot shows how we have adapted the above code for our scenario. As you can see ‘child-store.com’ is replaced by ‘tshirts-us.com’.

That’s it! All that remains is for you to configure your new child store to meet your own requirements. A good place to start is usually choosing a different root category (remember, everything above the root category won’t be displayed on the site) with products applicable to your new store.

NuBlue provide professional, high quality UK Web Hosting on Shared, VPS and Dedicated platforms.