Jump to content

Add hook without resetting module


Recommended Posts

Hi,

I have a blog module that is pretty big, and has a lot of data in it and also lots of settings.  I want to add a hook to display blog posts.

So I know it would work if I add this in install 

 

!$this->registerHook('displayBlogPost)

 

and then add

public function hookDisplayBlogPost($params) {

}

 

The problem is I dont want to reset this module.  I want all the settings and data to stay intact.  How can I accomplish this?  Thanks.

Link to comment
Share on other sites

  • 2 months later...
  • 4 years later...
On 1/26/2017 at 1:35 AM, -=peter=- said:

I used to use something like this in the constructor:



if (!$this->isRegisteredInHook('someHook'))
          $this->registerHook('someHook');

This is the solution for your problem. If you dont want to go through the hassle of coding and changing and want to save time, take a look at Generate Hooks For PrestaShop module in Codecanyon. You can do it with this module in no time.

  • Like 1
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...