d4rkbl4de Posted June 11, 2014 Share Posted June 11, 2014 (edited) HI all, I'm a newbie at Prestashop. I've been trying to move the Top Menu to a new div I wanted to create because of design purposes. For that, I understand I need a new hook. I've been looking online and all the tutorials seem to be missing a piece or it's for 1.5. It's confusing as hell and in the 4 hours of struggle, I could not make my custom hook work. 1. so I added a new hook in the database ps_hook name: displayMainMenu 2. I overwrite my blocktopmenu php in override/classes/module <?php class BlocktopmenuMainMenu extends Blocktopmenu { public function install() { if ( !parent::install() || !$this->registerHook('displayMainMenu') ) return false; return true; } public function hookDisplayMainMenu($params) { return $this->hookMainMenu($params); } } ?> 3. I overwrite my Front Controller php in override/controllers/front <?php class FrontController extends FrontControllerCore { public function initContent() { parent::initContent(); $this->context->smarty->assign( 'HOOK_MAIN_MENU', Hook::exec('displayMainMenu') ); } } ?> 4. I add the hook to my header.tpl {if $HOOK_MAIN_MENU} <div id="main-menu"> {$HOOK_MAIN_MENU} </div> {/if}The back office shows my new hook but it won't transplant the menu to it. So I tested the code in core file and it transplants it successfully but the menu doesn't show up in the front office. I want to do it properly so overwriting, so if I do that, it won't transplant AND it won't show up. What am I doing wrong or can somebody point me to a good tutorial that isn't chaotic and confusing?Thanks in advance. Edited June 11, 2014 by d4rkbl4de (see edit history) Link to comment Share on other sites More sharing options...
pterodactyl Posted October 19, 2014 Share Posted October 19, 2014 Hi, did you ever find a solution? I'm trying to move the homeslider to where I want it in but, like you, can only find half the answers Link to comment Share on other sites More sharing options...
NemoPS Posted October 20, 2014 Share Posted October 20, 2014 Try using this method: http://nemops.com/adding-hooks-to-prestashop-1-5/ It works on 1.6 as well 2 Link to comment Share on other sites More sharing options...
Recommended Posts