cupcakes Posted February 24, 2014 Share Posted February 24, 2014 I would like to add extra columns with content in the footer which doesn't exist in the way i'd like. On a normal website I would have just created it simply by markup and css. But I understand that PS has certain "rules" about such things, and I would like to follow those for it to be easy for others in the future to alter it.However, I'm not sure of how to go about it. How do I create a simple module where I can put my html? Also, how do I create a new hook? Link to comment Share on other sites More sharing options...
PrestaHeroes USA Posted February 24, 2014 Share Posted February 24, 2014 Hi, I found it much more useful for me to write modules for our shops, then I turn around and sell them as well. So it's worth the effort to learn if you like to do things yourself. Here are some offical guides: Creating a PrestaShop module and more on hooks Link to comment Share on other sites More sharing options...
vekia Posted February 24, 2014 Share Posted February 24, 2014 Also, how do I create a new hook? check this step by step guide http://www.prestashop.com/forums/topic/2182[spam-filter]create-custom-and-new-hook-in-ps-15/ 1 Link to comment Share on other sites More sharing options...
cupcakes Posted February 27, 2014 Author Share Posted February 27, 2014 Thanks El Patron I will have a look. Vekia: I tried that guide, but it didn't work for some reason. I have the latest prestashop, 1.5.6.2, should I go with the guide mentioned at the very top? Thanks. Link to comment Share on other sites More sharing options...
vekia Posted February 27, 2014 Share Posted February 27, 2014 hello strange that it doesnt work for you im using this method to create non default hooks and... it works, for each 1.5.x version may i know what hook you added and how? and in addition, what code you use in your module to handle this hook? Link to comment Share on other sites More sharing options...
cupcakes Posted March 4, 2014 Author Share Posted March 4, 2014 I did it from the beginning with a new one so it's clean for the example, hopefully you can see where I'm doing it wrong :/ Log into phpmyadmin Click ps_hook Click to add Enter 'displayMenu2' into the fields 'name' and 'title' Click run Download FrontController.php from classes>controller> Open up and search for 'HOOK_HEADER' => Hook::exec('displayHeader'), Add this underneath the above mentioned: 'HOOK_MENU2' => Hook::exec('displayMenu2'), Search for 'HOOK_TOP' => Hook::exec('displayTop'), Add this underneath the above mentioned: 'HOOK_MENU2' => Hook::exec('displayMenu2'), Add the new FrontController.php to override>controllers Open up header.tpl from my theme Add this in there: {$HOOK_displayMenu2} Upload header.tpl Log into my prestashop admin Click modules and transplant a module Transplant Top horizontal menu into displayMenu2, and I get "This module cannot be transplanted to this hook." Download the module-files for the menu Open blocktopmenu.php Search for top, and this line comes up first: public function hookDisplayTop($param) (and so forth) Add this underneath that full code: function hookdisplayMenu2($params) { return $this->hookhome($params, 'displayMenu2'); } Upload Still get: "This module cannot be transplanted to this hook." Link to comment Share on other sites More sharing options...
vekia Posted March 4, 2014 Share Posted March 4, 2014 instead of {$HOOK_displayMenu2} use {$HOOK_MENU2} in addition after this: Enter 'displayMenu2' into the fields 'name' and 'title' Click run new hook appears in database? Link to comment Share on other sites More sharing options...
cupcakes Posted March 23, 2014 Author Share Posted March 23, 2014 Replaced {$HOOK_displayMenu2} with {$HOOK_MENU2} in header.tpl. Yes, the new hook appears in the database. I still get this Notice: Undefined index: HOOK_MENU2 in /storage/content/21/104221/website.se/public_html/cache/smarty/compile/87/88/21/878821c06e433b5fc177942e9804ae4e0e6f5a4c.file.header.tpl.php on line 160 Notice: Trying to get property of non-object in /storage/content/21/104221/website.se/public_html/cache/smarty/compile/87/88/21/878821c06e433b5fc177942e9804ae4e0e6f5a4c.file.header.tpl.php on line 160 Link to comment Share on other sites More sharing options...
cupcakes Posted March 23, 2014 Author Share Posted March 23, 2014 Woops, forgot about that the 1.6 probably uses different codes now. So used {hook h="MENU2"} instead and now it doesn't give off that error. Still can't transplant the menu to it though. Should I change this in the blocktopmenu.tpl to something else? public function hookdisplayMenu2($params) { return $this->hookhome($params, 'displayMenu2'); } Thank you for your help! It's very helpful to use this forum, I get to learn fast. 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