treyj45 Posted November 14, 2016 Share Posted November 14, 2016 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 More sharing options...
vekia Posted November 15, 2016 Share Posted November 15, 2016 use "transplant" module tool and you will not have to reset / reinstall it http://doc.prestashop.com/display/PS16/Front+office+Positions#FrontofficePositions-Attachingamoduletoahook:Transplanting 4 Link to comment Share on other sites More sharing options...
treyj45 Posted January 24, 2017 Author Share Posted January 24, 2017 What if I am creating a new hook? Link to comment Share on other sites More sharing options...
treyj45 Posted January 25, 2017 Author Share Posted January 25, 2017 I ended up adding into db like INSERT INTO `ps_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES ('myNewHook', 'myNewHook', '', '1', '1') Then I went into positions and transplanted hook to module Link to comment Share on other sites More sharing options...
-=peter=- Posted January 25, 2017 Share Posted January 25, 2017 I used to use something like this in the constructor: if (!$this->isRegisteredInHook('someHook')) $this->registerHook('someHook'); 4 Link to comment Share on other sites More sharing options...
SmartDataSoft Posted March 5, 2021 Share Posted March 5, 2021 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. 1 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