jondrew Posted February 12, 2011 Share Posted February 12, 2011 HiI'm very new to presta shop and have just installed and begun to build a theme. I need to create a new hook, so in my database I've added a new item in the ps_hook section and this shows up within the back office section when I go to transplant a module (you can see it in the dropdown menu - it's called 'Navbar').I've also added {$HOOK_NAVBAR} into themes>mytheme>header.tpl and added 'HOOK_NAVBAR' => Module::hookExec('navbar'), into header.php located in the root directory. However when I try to hook a module into this hook it doesn't appear. Is there something else I need to do? ThanksJon Link to comment Share on other sites More sharing options...
Paul C Posted February 12, 2011 Share Posted February 12, 2011 How are you trying to "hook a module into this hook"? The module will have to have implemented : function hookNavBar($params) { // display something } Which unless you've written the module it won't.Paul Link to comment Share on other sites More sharing options...
jondrew Posted February 12, 2011 Author Share Posted February 12, 2011 Paul,Thanks for the reply so is there a way of adding code into a module so I can use a new hook? I'm new to the whole hook system and it seems very limiting, I simply want to add a horizontal navbar but I've already used the hook_TOP and HOOK_LEFT_COLUMN in the header to hold other modules so how could I place a navigation menu without creating a new custom hook?Thanks - sorry really new to presta shopJon Link to comment Share on other sites More sharing options...
Paul C Posted February 12, 2011 Share Posted February 12, 2011 You could modify an existing module, although you'll need to remember you did this when you upgrade before the end of the class declaration (last }) you could try adding something like: public function hookNavBar($params) { return $this->hookLeftColumn($params); } That is assuming that the output the module would put in the left column is what you want moved into your new "hook". Basically all you're doing is getting the module to do the same thing when called for your new hook as it would do if called in it's "proper" location. Paul Link to comment Share on other sites More sharing options...
schel4ok Posted March 20, 2011 Share Posted March 20, 2011 The module in new hook doesn't appear 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