Magento – multistore

(sites, shops and views)

Magento allows you to create a multistore – many stores managed from a single control panel. This allows you to set, for example, a category tree, language version and a set of products for each store separately.

Multistore structure is as follows: Website> Store> Store View.

In other words, the site consists of a number of stores, and a store is divided into views. The entire configuration can be done in the System > Manage Stores tab.

Implementation of the structure in a database

Three tables in the database are responsible for the implementation of the multistore structure:

 

  • core_website – contains the id, name and unique site code, the default group (default_group_id) and site (is_default);
  • core_store_group – contains the root of the category tree (root_category_id), the default store id (store_id) and the site to which the given store group belongs;
  • core_store – contains an id, code and the name of the view and the group to which it belongs.

 

ATTENTION! Naming tables in the database and the configuration panel is slightly different and can be confusing – namely store in the administration panel corresponds to the store_group in the database (and by analogy store view in the panel corresponds to store in the database).

Products and users

Products can only be attributed to specific sites (not to store and view) – this is done using the Websites tab in product edit (catalog_produt_website table in the database). Of course, assigning a product to a particular site makes it available in all stores and views belonging to the site. Also, users are assigned at the same level ( website_id column in the customer_entity table).

Attribute values ​​- EAV model

Each table of attribute values ​​in the EAV model includes an additional column (store_id) specifying to which view the given attribute value belongs (where 0 means a global value). If the given attribute can be defined, for example, at the website level (website) – as many rows is added as there are views belonging to the given site (one row for each view).

Attribute values ​​- flat model

With a flat data model, the situation is a little different – there is no store_id column, and a separate table is created for each type of entity, with the suffix corresponding to the view id (number):

  • catalog_product_flat_1, catalog_product_flat_2, …
  • catalog_category_flat_store_1, catalog_category_flat_store_2, …

When to select a given level

If using the multistore, we are frequently faced with the problem whether to create a separate site, store or just view. The answer depends on some basic information:

  • if you just need a different language version and the products (including prices), and category structure will be identical – just a new view (store view) is sufficient;
  • if you need another category structure – you need to add at least a new store,  because only at this level you can define the root of the category tree;
  • if the products can be different in each store (or may have different prices) – it is necessary to create a separate website,  i.e. the highest level of the structure.

In practice, often a separate site is created right away (unless we are absolutely certain that for example just another language version will be enough) – this allows for easy addition of a separate set of products, categories tree and language version in the future.

pluswerk