Kaby Posted July 31, 2014 Share Posted July 31, 2014 (edited) Hi all, I am using Prestashop 1.5.4.0 and I am trying to re-hook my newsletter block (in the right column). Here is what I do: - In the module install I have this line: if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !$this->registerHook('rightColumn')) return false; - Then I have this function: public function hookDisplayRightColumn($params) { return $this->hookDisplayLeftColumn($params); } I reseted the module but I can't hook this newsletter block on ANY module of prestashop (Right Column, Left Column, Header...) I have the error message "You cannot hook this block here" (I don't know the exact English message. What might I have forget ? Thanks ! Edited August 4, 2014 by Kaby (see edit history) Link to comment Share on other sites More sharing options...
Rolige Posted July 31, 2014 Share Posted July 31, 2014 Because you need register the right hook in the install function. Link to comment Share on other sites More sharing options...
Kaby Posted July 31, 2014 Author Share Posted July 31, 2014 Hi ty for your reply ! Isn't it what I am doing with : $this->registerHook('rightColumn') ? Thanks Link to comment Share on other sites More sharing options...
Rolige Posted July 31, 2014 Share Posted July 31, 2014 You need uninstall and install again the module to register the hook, or you can move it in module positions. Link to comment Share on other sites More sharing options...
Kaby Posted August 1, 2014 Author Share Posted August 1, 2014 Well thanks again for your help, you basically advice me to do what I have done already (see the initial post)... Link to comment Share on other sites More sharing options...
Rolige Posted August 1, 2014 Share Posted August 1, 2014 Ok sorry, but there is nothing more to be done, that's the correct way to display it in the right column. Link to comment Share on other sites More sharing options...
misthero Posted August 2, 2014 Share Posted August 2, 2014 i think your are mispelling the hooks maybe? can you try this? if (!parent::install() || !$this->registerHook('displayLeftColumn') || !$this->registerHook('displayHeader') || !$this->registerHook('displayRightColumn')) return false; than reinstall the module Link to comment Share on other sites More sharing options...
Kaby Posted August 4, 2014 Author Share Posted August 4, 2014 Hi ! Indeed I had a long and meticulous look on the naming of hooks and here is what I get now, which works: if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('rightColumn')) return false; The here is the name of my functions: public function hookLeftColumn($params) { $this->_prepareHook($params); $this->context->controller->addCSS(($this->_path).'blocknewsletter.css', 'all'); return $this->display(__FILE__, 'blocknewsletter.tpl', $this->getCacheId()); } public function hookRightColumn($params) { return $this->hookLeftColumn($params); } So that was actually a matter of right spelling of the name of hooks and functions, thanks for pointing me that issue ! And don't toatally understand as the hookDisplayLeftColumn function was the native one from the module. Have a nice day all ! Ty again ! Link to comment Share on other sites More sharing options...
misthero Posted August 4, 2014 Share Posted August 4, 2014 I think if you use $this->registerHook('displayLeftColumn') the function should be named hookDisplayLeftColumn() if you remove the "display" part from the hook registration the function should be renamed accordingly don't forget to mark the topic as solved prepending [sOLVED] to the title Link to comment Share on other sites More sharing options...
Kaby Posted August 4, 2014 Author Share Posted August 4, 2014 When I find when to edit the title of my topic I'll do it... Link to comment Share on other sites More sharing options...
misthero Posted August 4, 2014 Share Posted August 4, 2014 edit the first post and switch to full editor.. or open another topic asking how to rename topic titles 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