Child pages
  • Overriding default behaviors

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Overriding PrestaShop's own behavior (class files and controller files) in order to target a specific section of the required components.
  2. Overriding the visible parts of modules (Templates, JavaScript, style sheet language...) so that the themes can adapt better to them.

 

Warning
titleKeep overrides for your own shop

Overrides in PrestaShop are exclusive. This means that if your module overrides one of PrestaShop's behaviors, another module will not be able to use that behavior properly, or override it in an predictable way.

Therefore, overrides should only be used for your own local modules, when you have a specific need that cannot be applied without it.

It is not recommended to use an override in a module that you intend to distribute (for instance through the PrestaShop Addons marketplace), and they are forbidden in partner modules.

Overriding PrestaShop's classes and controllers

...

PrestaShop allows you to override or replace certain front-office front office module files with new ones within the same theme. The override is governed by the theme: once it contains a /modules folder (or more!), PrestaShop will browse its content for files which have the same name and path as those of existing modules, and replace these with the new ones.

...