Child pages
  • Understanding and using hooks

Versions Compared

Key

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

...

First of all, to correctly use the "hook," you must go into your module’s module's class and create a non-static, public method starting with the keyword "hook" and the name of "hook" used.
Then, only one single argument is passed: the array of different context information sent to the "hook".

...

Tip

There is no need to use the module’s module's “uninstall” method to remove the "hook".

...

Code Block
$params = array(
    'param_1' => 'value_1',
    'param_2' => 'value_2',
);
Module::hookExec('NameOfHook', $params);

...

How to add new one?

If so far you’ve you've followed how to use "hooks" and how to use them in PrestaShop, then you'll surely you realize that you’re you're missing some "hooks" like "MakeCoffe", "MakeFood" or "RespondToClientsForMe". Don’t Don't panic!

To create your own little personal "hook,” you just simply save a row in the database table "ps_hook" with the name of your "hook”. (See 0 and 1 if it is compatible with LiveEdit or not)

...