Using the Configuration class with multistore

You are probably asking yourself what about the Configuration class? We used it to store the module configuration, so what do we need to do if we want to make different configurations for each shop? The answer is: nothing.

The Configuration class is natively compliant with the multistore feature. If we look closer to the code of this class, we will see that the loadConfiguration method retrieves configuration values and splits them as per the shop:

if ($row['id_shop']) self::$_CONF[$lang]['shop'][$row['id_shop']][$row['name']]= $row['value']; else if ($row['id_shop_group']) self::$_CONF[$lang]['group'][$row['id_shop_group']][$row['name']] = $row['value']; else self::$_CONF[$lang]['global'][$row['name']] ...

Get PrestaShop Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.