Child pages
  • New Developers Features In PrestaShop 1.5

Versions Compared

Key

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

...

There are six main aspects of PrestaShop's Module API which received a significant overhaul for version 1.5: dynamic hooks, evolution of the override system, new filetree and operations, multishop feature, Addons webservice, and the update system. We will explore these one by one.

...

Hooks

Liste des looks 1.5 :
Définition des hooks dynamiques

Hooks are a fundamental part of PrestaShop's modules API. They enable modules to 'hook into' the rest of PrestaShop, and call functions at specific times, thereby setting your own code in motion.

There are two families of hooks:

  • "Action" hooks. For example, to send out a mail when a client creates a user account.
  • "View" hooks. For example, to display a module in a column.

New hooks

Info

Coming soon...

Dynamic hooks

PrestaShop brings the ability of defining dynamic hooks. In effect, there is now a hook before and after each action of each controller: PrestaShop's ObjectModel has been updated so that this new feature is automatically applied to existing code.

Evolution Of The Override System

Possibilité dPrestaShop'override des classes et les controllers de PrestaShop :
Depuis la 1.4 il est possible d'overrider des classes et des controllers de PrestaShop
Pour les modules dans PrestaShop 1.5, il existe un système pour overrider les classes et les controllers facilement.
Par exemple, pour overrider la class Cart.php dans un module il suffit de créer le dossier /override/classes/ dans le module et y placer l'override Cart.php
PrestaShop fera un merge automatique de l'override du module et de l'override déjà présents override system, which was introduced with PrestaShop 1.4, makes it easier for third party developers to include changes to the core methods without changing the core files.

Until now, you could only override PrestaShop's classes and controllers by placing the appropriate file(s) in either the /override/classes folder or the /override/controllers on.. The module API in PrestaShop 1.5 now enables you to override classes and controllers directly from a module.

For instance, should you need to override the Cart.php class, you could do this from a module: instead of placing your customized Cart.php file in the root's /override/classes folder, now you can simply put your Cart.php file directly in the /override/classes of your module's folder. PrestaShop will automatically merge of the module's overriding code and the overriding code that would already exist in the root /override folder.

The advantages are numerous, the major ones being:

  • easier to manage, install, and share along with the module itself.
  • multiple modules can make changes to the core classesn as long as they do not attempt to override the same functions.

New Filetree And Operations

...