Child pages
  • New Developers Features In PrestaShop 1.5

Versions Compared

Key

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

...

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 and AdminController base objects have been updated so that this new feature is automatically applied to existing code.

Info

Coming soon...

They make it possible for your code to hook to any object or back-office action.

Code Block

public function add($autodate = true, $null_values = false)
{
	// @hook actionObject*AddBefore
	Hook::exec('actionObjectAddBefore', array('object' => $this));
	Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));
}

This way, you can for instance ask for a module to hook itself to the action that is triggered before the creation of manufacturer. This will result in hookActionObjectManufacturerAddBefore.

Here is the list of available dynamic hooks:

  • actionObjectAddBefore
  • actionObjectObjectNameAddBefore
  • actionObjectAddAfter
  • actionObjectObjectNameAddAfter
  • actionObjectUpdateBefore
  • actionObjectObjectNameUpdateBefore
  • actionObjectUpdateAfter
  • actionObjectObjectNameUpdateAfter
  • actionObjectDeleteBefore
  • actionObjectObjectNameDeleteBefore
  • actionObjectDeleteAfter
  • actionObjectObjectNameDeleteAfter

There are more dynamic hooks in AdminControllers, and new ones will be added in the future.

Override

PrestaShop's 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.

...