Home - Addons - Addon connection
Addon connection
Addon connection by means of hooks
To display results of an addon operation, it is not necessary to check for addon availability (for example: {if $settings.Addons.affiliate == "Y"}) and create a code that would display these results. Now hooks are used to connect an addon.
In order to create a hook it is necessary to do the following:
- Create the hooks directory (if it isn't there) in the addon directory.
- In the hooks directory create a directory and give it the name of the controller where the hook will be called.
- In this directory create a template with the following name format: hook_name.action_performed_with_hook_code.tpl
action_performed_with_hook_code can have three options:
- post – result is added after the hook is declared
- pre – result is added before the hook is declared
- override – result overrides the hook block
For example: product_info.post.tpl
- Create the block function hook with the parameter name in the template to which the addon should be connected. The name value is specified in the following way: (name of the directory where hook template is located; it is defined in point 2):(hook_name)
|
Be careful when changing the existing hook templates, they can be connected in several places. |
| |