SWcoins.com Posted March 23, 2014 Share Posted March 23, 2014 Hello, I was wondering if anybody knew how to create a hook? I know how to write a module using the existing hooks but what I want to do is write a module that hooks under the product long description. If one exists I am over looking it, if not, how would you go about writing a module with a customized hook? The online docs don't explain how to create a hook. Thanks, Josh SWCoins.com Link to comment Share on other sites More sharing options...
inweb Posted March 23, 2014 Share Posted March 23, 2014 You need to create a record in ps_hook table and then place the following code to the existing PS file (depends on what do you want to hook): Hook::exec('yourHookName', array( 'example_parameter1' => $example_value1, 'example_parameter2' => $example_value2, ));By using the second arguments you can pass arguments to the hook. Link to comment Share on other sites More sharing options...
Enrique Gómez Posted March 23, 2014 Share Posted March 23, 2014 In PS 1.5 is very easy , simply put in the smarty template {hook h='yourNewHook'} and in the module register $this->registerHook('yourNewHook') and of course implement hookYourNewHook() http://nemops.com/adding-hooks-to-prestashop-1-5/#.Uy9QOoUv-Eo Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now