Jump to content

How to create a hook?


SWcoins.com

Recommended Posts

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

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

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...