Book Image

PrestaShop Module Development

By : Fabien Serny
Book Image

PrestaShop Module Development

By: Fabien Serny

Overview of this book

Table of Contents (19 chapters)
PrestaShop Module Development
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
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...