Kerm Posted October 16, 2015 Share Posted October 16, 2015 (edited) Hello, I need a help. Prestashop 1.6.1.2 Can i override module class and add new function? I try do this: <?php if (!defined('_PS_VERSION_')) exit; class BlocktopmenuOverride extends Blocktopmenu { public function hookDisplayMyHook($param) { $this->user_groups = ($this->context->customer->isLogged() ? $this->context->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP'))); $this->page_name = Dispatcher::getInstance()->getController(); if (!$this->isCached('blocktopmenu.tpl', $this->getCacheId())) { if (Tools::isEmpty($this->_menu)) { $this->makeMenu(); } $shop_id = (int)$this->context->shop->id; $shop_group_id = Shop::getGroupFromShop($shop_id); $this->smarty->assign('MENU_SEARCH', Configuration::get('MOD_BLOCKTOPMENU_SEARCH', null, $shop_group_id, $shop_id)); $this->smarty->assign('MENU', $this->_menu); $this->smarty->assign('this_path', $this->_path); } $html = $this->display(__FILE__, 'blocktopmenu.tpl', $this->getCacheId()); return $html; } } But in back office in hooks possition i dont see new hook for this module...what i do wrong? Edited October 16, 2015 by Kerm (see edit history) Link to comment Share on other sites More sharing options...
coeos.pro Posted October 16, 2015 Share Posted October 16, 2015 you definitely want to go through a new hook? create a simple function not you agree? public function displayMyHook($param) Link to comment Share on other sites More sharing options...
Kerm Posted October 16, 2015 Author Share Posted October 16, 2015 (edited) In documentation says, i need first registered hook at least once, from a module by using install, but how register new hook without reinstalling module? Edited October 16, 2015 by Kerm (see edit history) 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