Book Image

PrestaShop Module Development

By : Serny
Book Image

PrestaShop Module Development

By: Serny

Overview of this book

If you are a developer who is new to PrestaShop and wants to get a good foundation in development on the PrestaShop framework, this book is for you. It's assumed that you will have some experience with PHP5, jQuery, and HTML/CSS (no need to be an expert on it).
Table of Contents (13 chapters)
12
Index

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']] = $row['value'];

In fact, for modules that only use the Configuration class method (such as mymodpayment) and no custom MySQL table, they are automatically compliant with the multistore feature.

Note

Good to know

If the module has been installed...