Technical principles behind a module

A PrestaShop module consists of a main PHP file with as many other PHP files as needed, as well as the necessary template (.tpl) files and assets (images, JavaScript, CSS, etc.) to display the module’s interface, whether to the customer (on the front office) or to the merchant (on the back office).

Any PrestaShop module, once installed on an online shop, can interact with one or more “hooks”. Hooks enable you to hook/attach your code to the current View at the time of the code parsing (i.e., when displaying the cart or the product sheet, when displaying the current stock, etc.). Specifically, a hook is a shortcut to the various methods available from the Module object, as assigned to that hook.

For security reasons, during validation, we do not accept any call to another website/API in order to retrieve code that will later be executed on server or client.

Modules’ operating principles

Modules are the ideal way to let your talent and imagination as a developer express themselves, as the creative possibilities are many and you can do pretty much anything with PrestaShop’s module API.

Any module:

  • can display a variety of content (blocks, text, etc.), perform many tasks (batch update, import, export, etc.), interface with other tools, and much much more.
  • facilitates interactions between the shop and external services.
  • can be made as configurable as necessary; the more configurable it is, the easier it will be to use, and thus will be able to address the needs of a wider range of users.
  • can add functionalities to PrestaShop without having to edit its core files, thus making it easier to perform an update of PrestaShop without having the transpose all core changes. Indeed, you should always strive to stay away from core files when building a module, even though this may seem necessary in some situations.

Main differences between 1.6 and 1.7 modules

PrestaShop 1.7 was built so that modules that were written for PS 1.6 could work almost as-is – save for minor changes and a cosmetic update, the template files being in need of adapting to the 1.7 default theme.

The major module development changes in PrestaShop 1.7 are explained in details in this Build article, and are integrated into this updated documentation. If you already know how to create a module that works with PS 1.6, we strongly advise you to read that article from top to bottom in order to get up to speed with 1.7 development.

A few native modules have been split between 1.6 & 1.7 versions of PrestaShop, as listed here:

Original module for PrestaShop 1.6 Updated module for PrestaShop 1.7
advancedeucompliance ps_legalcompliance
bankwire ps_wirepayment
blockadvertising ps_advertising
blockbanner ps_banner
blockbestsellers ps_bestsellers
blockcart ps_shoppingcart
blockcategories ps_categorytree
blockcms ps_linklist
blockcmsinfo ps_customtext
blockcontact ps_contactinfo
blockcurrencies ps_currencyselector
blockcustomerprivacy ps_dataprivacy
blocklanguages ps_languageselector
blocklayered ps_facetedsearch
blockmanufacturer ps_brandlist
blockmyaccount ps_customeraccountlinks
blocknewsletter ps_emailsubscription
blocknewproducts ps_newproducts
blockrss ps_rssfeed
blocksearch ps_searchbar
blocksocial ps_socialfollow
blockspecials ps_specials
blocksupplier ps_supplierlist
blocktopmenu ps_mainmenu
blockuserinfo ps_customersignin
blockviewed ps_viewedproduct
carriercompare ps_carriercomparison
cashondelivery ps_cashondelivery
cheque ps_checkpayment
crossselling ps_crossselling
feeder ps_feeder
followup ps_reminder
ganalytics ps_googleanalytics
homefeatured ps_featuredproducts
homeslider ps_imageslider
mailalerts ps_emailalerts
onboarding welcome
productscategory ps_categoryproducts
producttooltip ps_productinfo
socialsharing ps_sharebuttons

Modules folder

PrestaShop’s modules are found in the /modules folder, which is at the root of the PrestaShop main folder. This is true for both default modules (provided with PrestaShop) and 3rd-party modules that are subsequently installed.

Modules can also be part of a theme if they are really specific to it. In that case, they would be in the theme’s own /modules folder, and therefore under the following path: /themes/[my-theme]/modules

Each module has its own sub-folder inside the /modules folder: /bankwire, /birthdaypresent, etc.

About the cache

The /cache/class_index.php file contains the link between the class and the declaration file. If there is a caching issue, this file can safely be deleted.

The /config/xml folder contains the list of all the base modules:


When the store’s front-end doesn’t quite reflect your changes and emptying the browser’s cache is not effective, you should try emptying the following folders: