Making a module multistore-compliant
As you may have seen how multistore worked in the BO controllers, PrestaShop can contain multiple shops, each shop can present some of the items of the catalog, and some categories can contain a separate inventory. A shop is a sub-member of a shop group, which enables us to share data with other shops.
The general idea if you use multistore features is that your database tables and entities must contain the id_shop
and id_shop_group
attributes, even if you are in localized tables. As you now know how to handle the Lang
entities for your entities objects, you should be able to add the necessary shop
attributes in the same way.
The necessary information about the multistore status, such as which shop and shop group are selected, is available via the multistore
feature adapter. You can retrieve this service like this:
$multistoreFeature = $this->get('prestashop.adapter.feature.multistore');
And the shop context adapter is accessible...