tozi Posted May 3, 2014 Share Posted May 3, 2014 (edited) Hi all, i have this little problem. I crate a new hook http://www.prestashop.com/forums/topic/2182[spam-filter]create-custom-and-new-hook-in-ps-15/ I transplate home slider module in this hook. In homeslider.php i have this public function hookdisplayTop2($params) { $this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js'); $this->context->controller->addCSS($this->_path.'bx_styles.css'); $this->context->controller->addJS($this->_path.'js/homeslider.js'); return $this->display(__FILE__, 'homeslider.tpl', $this->getCacheId()); return $this->hookhome($params, 'displayTop2'); } It works but this module is in two positions look http://zahradny.simplydesign.sk/index.php When i unhook module from home, then disappear completely. Edited May 3, 2014 by tozi (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2014 Share Posted May 3, 2014 by default homeslider is attached to displayTopColumn hook (ps 1.6) you have to unhook it from this hook, instead of "home" hook. why you've got two return command? Link to comment Share on other sites More sharing options...
tozi Posted May 3, 2014 Author Share Posted May 3, 2014 (edited) I have 1.5.6.1. I have two return because when i delete eg. return $this->display(__FILE__, 'homeslider.tpl', $this->getCacheId()); then home slider disappears. This is my question. How to be right? Look to page yet. I unhook from home. Slider disappeared completely. Edited May 3, 2014 by tozi (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2014 Share Posted May 3, 2014 use one return without caching $this->display(__FILE__, 'homeslider.tpl'); and unhook module from displayHome hook. + make sure that your new hook is correctly implemented to your theme with {hook::exec('yournewhook')} where you added it? Link to comment Share on other sites More sharing options...
tozi Posted May 3, 2014 Author Share Posted May 3, 2014 Blank page. I added this public function hookdisplayTop2($params) { $this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js'); $this->context->controller->addCSS($this->_path.'bx_styles.css'); $this->context->controller->addJS($this->_path.'js/homeslider.js'); return $this->hookhome($params, 'displayTop2'); } I created a hook in accordance this tutorial. http://www.prestashop.com/forums/topic/2182[spam-filter]create-custom-and-new-hook-in-ps-15/ When i need display module i added this {hook h='displayTop2'} Link to comment Share on other sites More sharing options...
tozi Posted May 3, 2014 Author Share Posted May 3, 2014 Ok so i have a solution. public function hookdisplayTop2(){ if(!$this->_prepareHook()) return; if ($this->context->getMobileDevice() != false) return false; $this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js'); $this->context->controller->addCSS($this->_path.'bx_styles.css'); $this->context->controller->addJS($this->_path.'js/homeslider.js'); return $this->display(__FILE__, 'homeslider.tpl'); } 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