Set up Layouts on Multi-Store - for opencart 1.5.x

Posted by Flo on 02 Jul 2012

Set up Layouts on Multi-Store - for opencart 1.5.x

Many people are confused about layouts and specially how to set them up when they are using multi-store.

A layout reffers to a page or a group of pages in your opencart store, for which you can controll the display of your opencart modules.

Layouts can be added and edited in your opencart admin by navigating to system > design > layouts.

The pages that belong to a layout are controlled by routes per store. Example: The 'Home' layout has the route 'common/home' added for the default store.(this home layout exists by default, since you installed/upgraded opencart).The only page that has the route 'common/home' is obviously the homepage, meaning that whatever modules you add to the home layout will only display on homepage of the default store. Another example of a preseted layout is the 'Account' which has the route 'account' for the default store, which as you notice is a one word route(which is actually the first part of more routes like: account/login > for login page, account/register > for the register page, account/account > for the actual account page). In this case the account layout applies to a group of pages, because as explained, more pages have the account route, which means that whatever modules you added to the account layout will display on login page, register page, accoun page, newsletter pages and others > all on the default store.

As mentioned above, all the presetted layouts have routes added for the default store. So if you allready added a new store, the system wont automaticaly set the layouts for it, you have to do it.

You have 2 choices when it comes to setting layouts for multistore, edit the existing layouts and add new route for the new store or create new layouts for the new store.

If you want your new store, to display on its layouts the same modules as the default store does, you need to edit all presetted layouts from in system > design > layouts , and on each layout edit store, click on add route. At store select the new store you added and at route, insert the same route as above is for default store. Example: After you did the mentioned edit for the home layout, if you were to add the module featured to the home layout, the featured module would appear on the both stores on the homepage in the exact same position(of course, each featured module, would only display the products that are assigned to the store it displays on).

If you want your new store to look different that the default one, to have a different configuration for modules than the default one, then you would have to create new layouts for it. Basically , you would duplicate all the existing layouts, only that you would modifies their name (Ex: Home would become Home-Store2 - so you can diferentiate the laayouts per store when you edit the module) and add the same routes as the default ones, only that in the store selector you would select the new store. Why do this? Because in the default store you would be able to set the featured module to homepage while in the new store , you could set only the latest module to homepage. This of course would apply for all modules and all positions.