Need some help?

I'm usually available for small jobs or problem solving with jQuery or css, at reasonable rates. Just get in touch.

Web Hosting

We recommend Clook for web hosting. UK based, great service and great value.

Buy me a drink

If you've found this useful, particularly for commercial projects, you might consider making a small donation.

Opencart – Setting up multiple stores

Here’s how to set up multiple stores on Opencart using subdomains. You could use this to set up a separate store to run a different theme – for example a mobile-optimised theme.

Create your subdomain

Let’s assume you’re running your main store on www.yourstore.com, and that your web hosting locates the files for your store in its root directory public_html. For a mobile store, let’s also assume you’re going to sit this on m.yourstore.com.

You need to create your new domain and point it at the same folder that your main store uses. If your hosting uses cPanel then it should look something like this:

Screenshot of additional domain in cPanel

Create your new store

The next step is to create the new store in Opencart. Go to System > Settings and click the ‘Insert’ button. This should bring up screens to create your new store. For the Store URL and SSL URL, enter your new domain, adding https to the SSL URL if you have a certificate installed. Make sure you close your entries with a ‘/’ or it won’t work. Fill out the rest of the details on the General tab, and your screen should look something like this:

Screenshot of Opencart store configuration screen

Now the Store tab. Here you need to enter the store name, and select the theme you want to use (e.g. a mobile theme). Set the default layout to ‘Default’. Your screen should look something like this:

Screenshot of Opencart store configuration screen

You can then save your new store.

Configure your new store

Opencart will create your new store with all the default settings, so you will need to amend all the store settings as required.

Opencart will not load any categories, products, manufacturers or information pages to your new store (unfortunately?). You’ll need to do all these manually, or by running some SQL queries from the backend. To do this manually:

  • Categories – From the Category edit screen, go to Data > Stores to mark the checkbox against your new store.
  • Products – From the Product edit screen, go to Links > Stores to mark the checkbox against your new store.
  • Manufacturers – From the Manufacturer edit screen, mark the checkbox against your new store.
  • Information – From the Information edit screen, go to Data > Stores to mark the checkbox against your new store.

Modules in your new store – using Layouts

If you’re using Opencart 1.5 or later, then any Modules that you have configured will not be carried over to your new store. This is a good thing, I think, since it effectively gives you control over which modules are used by your different stores. Opencart manages the display of extensions by using the concept of Layouts – which is a little tricky to grasp, I think.

A Layout is the entity which links Modules to pages and stores. When a page is to be displayed on a store, Opencart looks up the layout appropriate to that page on that store, and then finds any modules configured for that layout.

So, if you make no changes to any Layouts after creating your new store, then when a page on your new store is displayed, Opencart will search for the appropriate Layout, and not find one, so no Modules will be displayed. So, to display a Module on your new store, we need to configure a Layout.

I’ll illustrate this with an example. Let’s assume you have some Modules on your default store homepage, and you want to display the same Modules on your new store. First thing is to navigate to System > Design > Layouts and click ‘Edit’ against the ‘Home’ Layout. You should then see something like this:

Screenshot of Opencart store configuration screen

You’ll see that the existing (default) entry tells Opencart that for the default store the Layout ‘Home’ should be used with the route, or page ‘common/home’ – which is the home page. We need to tell Opencart to use the same Layout for the new store. So, click ‘Add Route’, select the new store and enter ‘common/home’ against the route – like this:

Screenshot of Opencart store configuration screen

Click ‘Save’ and you’re done.

You can probably see from this that it’s possible to display different modules on your new store homepage by creating a new Layout and assigning it to your new store only. Here’s some more details on how to do this.

You’re done

Once this is complete, your new store should display via the subdomain, with the products etc and modules that you have enabled in the steps above. Payment, Shipping and Order Totals will all be the same as your existing store.

Tags:

47 responses to “Opencart – Setting up multiple stores”

  1. Smit Shah says:

    Thanks for this..
    Opencart is not having anything for modules & banners for multi-store ?

  2. Simon says:

    Smit
    Yes, you can do this with layout. Have a look at this explanation.

  3. Admin says:

    How can i configure the store? I can’t find your configure style in the Admin Panel of Opencart, please give the solutions quickly.

  4. Admin says:

    Where i can install your mobile script? Directly in the root folder of hosting panel or in the folder name with M in Public_Html folder?

  5. Simon says:

    The theme should be unzipped in the root folder of your Opencart installation.
    Once installed properly you should be able to assign the theme to a store.
    You shouldn’t have a separate folder if you’re installing a mobile theme – see the instructions above.

  6. Admin says:

    Check my testing website :- m.area83.tk It shows some errors, how can i solve it? I’m using Opencart1.5.5.1

  7. Simon says:

    I don’t think those errors are coming directly from the mobile theme. Your default store is showing the same and additional errors.
    Do you have vqmod installed properly?

  8. Dave says:

    I got it all woking but only issue i cant get the product image to show on my mobile site m.

    opencart 1.5.1

  9. Simon says:

    Dave

    I can’t access your mobile site at the moment. I’ve not come across that issue. What happens? Does the rest of the site display OK?

  10. Dave says:

    I got it fixed just had to change the image file name from my mobile path to the website inage folder

  11. Don says:

    Hi thanks for this!

    My store is in a subdomain and i installed this mobile theme in the root of subdomain where is my opencart store. But it dont work not show the mobile theme.
    Is there any sollution?
    Thank you Simon!

  12. Simon says:

    Don

    The theme will not automatically detect a mobile browser as it stands. Have a look here for ways the theme can be employed.

  13. Don says:

    Thank you work fine now!

    One more question if i have thousands products than how can i import to the mobile store just one by one?

    Thank you Don

  14. Simon says:

    Don
    You can run some SQL on your database to do this – have a look here for description.

  15. Donovan says:

    Hi Simon

    Thanks for the above worked a charm. But now I’m having issues with SSL. The main site is http://www.assceneon.com and I have multistore set up with http://www.babycakescoffee.com as the second site. I have SSL cert for assceneon.com (shared) but when I go to https://www.babycakescoffee.com it does not go to the secure site only non secure http:// can you help? Does open cart offer this? I have looked into wildcard SSL but my hosts says that they cannot handle it and nor can opencart! Any help is appreciate

    Regards

    Donovan

  16. Simon says:

    I haven’t done this myself, so check before buying, but I think what you need is a multi-domain SSL certificate.

  17. Tim says:

    Hi, thanks for the tutorial, I followed the directions but when I go to my subdomain. mobile.domainmcom which should go to domain.com/store, it goes to domain.com instead. I did include the / in setup, a common mistake I read people made. I am running 1.5.5.1 thanks.

  18. Simon says:

    Hi Tim

    That sounds like you’ve got your cPanel set up correctly but there’s something wrong with the Opencart settings.

  19. Admin says:

    My we hosting provider is serversfree.com where i can create subdomains but can edit it, can’t make document root to public_html, when i try to make subdomain there, a new folder ‘m’ is created in the root folder of database. Now how can i solve this issue?

  20. Simon says:

    That sounds like one to take up with your hosting provider really, it’s not something that I can help with.

  21. Mark says:

    Hi Simon
    I am just setting up my multistore and seem t have most things working properly, but I have noticed that when I now try to add a new product that only the manufacturers from the second store show up iin the links tab – I have a lot of manufacturers in the default store but none of these appear.
    Any pointers on how to resolve this?

  22. Simon says:

    It sounds like you don’t have the manufacturers enabled for your second store – like products, they can be enabled/disabled by store.

  23. zjunyu says:

    Good Job, Thank you.

  24. Tim says:

    Thank you for answering my question earlier, you say the CPANEL is setup properly, which I know, but the Opencart is now. I have followed your instructions several times, to see what I may have missed, and everything is exactly as you show. Any suggestions? It still goes from http://mobile.domain.com to the domain.com site.

  25. Simon says:

    From your earlier question, is your store in a subfolder? If so is this correct on your subdomain on cPanel?

  26. taun khanna says:

    if i want to use two sites are on sub domains but there is no site on main domain .i just put a html page on main domain and put two links on it. then how will i manage both stores

  27. Simon says:

    I’m not quite sure what you’re asking. If you have two subfolders you can still set them up in cPanel to resolve the the same address and run them as one OC installation.

  28. Ian Haney says:

    Help I am stuck and not sure what to do

    I have unzipped the theme and put inside a subfolder called m and followed all the instructions and redirected it using the php code but I just get a blank white page

    The mobile site is http://www.the-giftery.co.uk/m/

    Any ideas where I gone wrong

    Kind regards

    Ian Haney

  29. Tim says:

    Well, I went back to check it and it does now lead to the mobile template like it should. Now my problem is nothing loads. I get Home My Account Shopping Cart at the top, then the footer showing powered by opencart, and the name of the store.

    I did go through the process of adding the store to the categories, products etc. I also went into the modules, and did what your tutorial shows.

  30. Tim says:

    I was able to get it working, way back when I disabled the mobile_theme.xml because of a PHP error which made my site almost useless. I forgot it was still disabled. I did however find that the PHP error was with the VQMOD Refine Search Sub Category Images, which was the only free mod that allowed sub category images. If you purchase another version, it does not edit files, and works great with your mod. Thank you for a great script!

  31. Simon says:

    Ian

    Sorry for the delay in replying, I have been on holiday.
    From what you describe, it sounds like there might have been an issue with your Opencart configuration – which is why you got the blank page.
    If you’re still trying to make this work get back in touch.

  32. Ashraf Tayab says:

    Dear Sir,,,
    Thank you for your Opencart – Setting up multiple stores, I am new with opencart, by reading your Opencart – Setting up multiple stores, I understand to make multiple stores.
    Thank you

  33. Agus Halim says:

    hi
    thanks for this great articles, i would like to know how is it possible to separate individual admin login page separate product, separate anything so when we totally create a new store in multistore it’s just like new setup. and other store only can see their dashboard, sales and item?
    thanks

  34. Simon says:

    If you’re running multiple stores from on installation then the stores share the database, so the products are stored in a single table (for example). Short of writing a fair bit of code for admin so that users can only see products from a specific store, there’s no way of doing what you want.

  35. Agus Halim says:

    hi
    since i’m not a programmer i would like to know the code how to tweak so with this single table the users only can see their products from a specific store. any paid/free service do let me know. many thanks

  36. Simon says:

    Hi Agus

    Within Opencart you can assign a product to a store, and therefore restrict certain products to only appear in specific stores. Is that what you meant? If not could you explain exactly what you’d like to be able to do?

  37. Charles says:

    Hi Simon

    I am trying to create a multistore in opencart following your steps but what happens is when I open the subdomain http://www.shopcharles.centrodelvalle.com, it doesn’t charge the home page and anything.

  38. Simon says:

    I get a not found error on your subdomain. This suggests that the subdomain isn’t set up correctly rather than anything to do with Opencart.

  39. johnny p says:

    Good morning,

    I create all steps specified here:
    1. I create an sub-domain using CPanel
    2. I specified from setting on ¨Adress URL¨ as your description : http://demo1.my-shopping.ro/

    So, I don´t see the theme choose instead of those message which can be see if you will type in browser the adress of my sub-domain.
    What I don´t understand is if the steps is so simple, why don´t work?

    I waiting much early is possible your answer and advice or other sugestion which can help me to resolve the error.

    Thank you in advance for support and collaboration.
    Best regards.

  40. Simon says:

    The problem there is with the subdomain – for some reason this is not working as expected. I think this is probably an issue to take up with your hosting company.

  41. Robin says:

    Hi, can you assist me for multistore? Is it possible to set multistore in different domain? Like my Main store is set into ABC.com and i want to set another store in different domain as XYZ.com. Is it possible?
    I am also getting issue related to layout thing, as its showing some modules in all pages of substore.

    Thanks
    Robin

  42. Simon says:

    You can run multistore on different domains, yes.
    You can control which modules appear by creating a layout which is store specific.

  43. simon says:

    Hi
    Great article – the only place I’ve seen mention of layouts which had flummoxed me for a while!
    I have a multi-store setup but in admin on my second store, on the server tab of settings I only see the Use SSl section and nothing else. Any idea how this has happened or how to correct it?

  44. Simon says:

    That’s not an error. The rest of the settings can only be set per server, rather than per store, and so only appear on that tab on the default store Settings > Server tab.

  45. simon says:

    Really? I’ve spent ages trying to spot what was wrong!
    If that’s the case how do I put the second store into maintenance mode but leave the default store live?

  46. Simon says:

    You can’t do that out of the box – I dare say there’s an extension that’ll do it. However, you could do this via by creating a specific maintenance theme which has nothing on it except a ‘sorry’ message, and then setting your desired store to use the maintenance theme.

  47. simon says:

    That’s a good idea. I’m slowly getting the hang of Opencart but odd little tricks like that evade me for now.
    Really appreciate the help.

Useful? Interesting? Leave me a comment

I've yet to find a way of allowing code snippets to be pasted into Wordpress comments - so if you're trying to do this you'd be better off using the contact form.