prestashop_newuser Posted September 28, 2013 Share Posted September 28, 2013 Hi, I am doing a small module in Prestashop. In that I want my content should come in the header top area (Below I have attached a reference image where I want the content).As for now my function for hook is like this for install and hook I have code like this public function install() { if (!parent::install() || !$this->registerHook('home') || !$this->registerHook('header')) return false; return true; } public function hookHome($params) { global $cookie, $smarty; $value=array(); $sql_select="SELECT * from "._DB_PREFIX_."tablename where status='1'"; $value=Db::getInstance()->ExecuteS($sql_select); print_r($value); $smarty->assign('array',$value); return $this->display(__FILE__, 'modulename.tpl'); } I tried to change my code for function hookHome to hookHeader but it did not worked for me. So can some one kindly tell me how to solve this? Link to comment Share on other sites More sharing options...
vekia Posted September 28, 2013 Share Posted September 28, 2013 hello you have to use "hookTop". why? hookHeader is a place where you can attach scripts or css files. This is "invisible" section. hookTop is a section where you can see whole elements on the top: so, please use registerHook('top') in install function then create public function hookTop($params) and include there .tpl file then go to modules > positions and move your module in displayTop list to the top of the list (just drag n drop it) Link to comment Share on other sites More sharing options...
prestashop_newuser Posted September 30, 2013 Author Share Posted September 30, 2013 hello you have to use "hookTop". why? hookHeader is a place where you can attach scripts or css files. This is "invisible" section. hookTop is a section where you can see whole elements on the top: so, please use registerHook('top') in install function then create public function hookTop($params) and include there .tpl file then go to modules > positions and move your module in displayTop list to the top of the list (just drag n drop it) Hi, I just follwed what you had suggested. I just made my code for install like this public function install() { if (!parent::install() || !$this->installDB() || !$this->registerHook('home') || !$this->registerHook('header') || !$this->registerHook('top')) return false; return true; } and for hookTop I just did like this public function hookTop($params){} After all here in the view section the blue part where the text This is again a dummy has been written. It is coming just below the menu. But I want the block should come on the top part( over the quick links). I had tried to adjust that in my css like this #myblock { display:block; position: absolute; top: 0; } but it is overlapping the quick menu section. So how to make that fix on top part? Link to comment Share on other sites More sharing options...
prestashop_newuser Posted September 30, 2013 Author Share Posted September 30, 2013 Hi, I just follwed what you had suggested. I just made my code for install like this public function install() { if (!parent::install() || !$this->installDB() || !$this->registerHook('home') || !$this->registerHook('header') || !$this->registerHook('top')) return false; return true; } and for hookTop I just did like this public function hookTop($params){} After all here in the view section the blue part where the text This is again a dummy has been written. It is coming just below the menu. But I want the block should come on the top part( over the quick links). I had tried to adjust that in my css like this #myblock { display:block; position: absolute; top: 0; } but it is overlapping the quick menu section. So how to make that fix on top part? Hi, Finally I got the solution. I just added a jquey in the public function hookHeader() {...................} in that js file I just write jQuery(document).ready(function($) { jQuery("body").prepend($("#myblock")); }); and it worked... Thanks Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 hello thank you for your solution im going to mark this topic as [solved] best regards Link to comment Share on other sites More sharing options...
Recommended Posts