Jump to content

Add custom hook to module without editing the module php file?


dannyrippon

Recommended Posts

Hi,

 

Is there a way to add a new custom hook to a module without having to edit the module php file.

 

If I edit the module php file, each time i upgrade the module my modifications will be deleted overwritten.

 

I have added new hooks to the database and extended the FrontController, but I want to use these hooks with a number of modules but dont want to have to change each of the modules core php file. is there a way of overriding them or does anyone have any other suggestions?

 

Thanks

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

You can add the hook to the database either manually or using your module.

 

Avoid using overrides at all costs.

 

1.4
INSERT INTO `ps_hook` (`name`, `title`, `description`)
		   VALUES ('nameOfHook', 'Name Of Hook', 'It is a custom hook !');

 

Then registerHook

 

Then as require dmodules hook priority.

 

http://www.prestasho...e-install-1415/

Edited by elpatron (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...