stratboy Posted July 5, 2013 Share Posted July 5, 2013 Hi. I created new hooks and assigned to smarty in an overridden frontcontroller. I wanted to place them in init() or displayHeader(), but it simply doesn't work. I have to place theme in initHeader() instead. Class FrontController extends FrontControllerCore{ public function initHeader(){ $this->context->smarty->assign('HOOK_HEADER_TOOLS', Hook::exec('displayHeaderTools')); $this->context->smarty->assign('HOOK_HEADER_RIGHT_BOX', Hook::exec('displayHeaderRightBox')); $this->context->smarty->assign('HOOK_HEADER_MAINMENU_BOX', Hook::exec('displayHeaderMainMenuBox')); parent::initHeader(); } }//end FrontController Why aren't they recognized if I put them in init() or displayHeader()? (I would receive a smarty Notice like Undefined index [..] Trying to get property of non-object [...] etc--) Link to comment Share on other sites More sharing options...
NemoPS Posted July 5, 2013 Share Posted July 5, 2013 I suggest you use the new way to create hooks instead. Here: http://blog.arvixe.com/adding-hooks-to-prestashop-1-5-the-new-way/ Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted July 5, 2013 Share Posted July 5, 2013 Hi, If you check initial FrontController::displayHeader code, you will see that this method is depricated and the most likely is not used on the necessary page. Best regards. Link to comment Share on other sites More sharing options...
stratboy Posted July 5, 2013 Author Share Posted July 5, 2013 Hi, If you check initial FrontController::displayHeader code, you will see that this method is depricated and the most likely is not used on the necessary page. Best regards. Hi! You're right! And what about using the init() method? Why doesn't it work? Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted July 5, 2013 Share Posted July 5, 2013 Hi, It is hard to say. It is necessary to check the whole code and see the definite case. init() is not the method which should be reloaded. initContent() is better. Best regards. Link to comment Share on other sites More sharing options...
stratboy Posted July 5, 2013 Author Share Posted July 5, 2013 Hi, It is hard to say. It is necessary to check the whole code and see the definite case. init() is not the method which should be reloaded. initContent() is better. Best regards. initContent().. Yesss, interesting, thank you!!! 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