haimbilia Posted April 10, 2016 Share Posted April 10, 2016 hello everyone im trying to hook a module above the data sheet the module im trying to hook is called tagsicons: http://addons.prestashop.com/en/19606-icon-tags-for-products.html my theme is default-bootstrap my prestashop is version 1.6.1.4 i already registered a hook using the install of this module with this: public function install() { if !parent::install() || !$this->registerHook('displayRightColumnProduct') || !$this->registerHook('displayProductBeforeData')) return false; return true; } that worked well. then i added this line above the <!-- Data sheet --> in product.tpl <section class="page-product-box"> <div class="block_content"> <ul id="usefull_link_block" class="clearfix no-print"> {hook h='displayProductBeforeData'} <li class="print"> </li> </ul> </div> </section> then i added to tagsicons.php public function hookdisplayProductBeforeData($params) { $id_product = Tools::getValue('id_product'); $id_lang = (int) $this->context->language->id; $product_tags = Tag::getProductTags($id_product); $tags = $product_tags[$id_lang]; $icon_tags = array(); if(is_array($tags)){ foreach ($tags as $tag) { $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'tagsicons` WHERE id_lang = ' . (int) $id_lang . ' and name=\'' . pSQL($tag) . '\''; $tab_tag = Db::getInstance()->ExecuteS($sql); if (isset($tab_tag['0']) && $tab_tag['0']['name'] != '') { $icon_tags[] = $tab_tag; } } } $listado = false; $this->context->smarty->assign(array( 'context_help' => Configuration::get('context_help_tagsicons'), 'tag_link' => Configuration::get('tag_link_tagsicons'), 'panelTitle' => Configuration::get('panel_title_tagsicons'), 'listado' => $listado, 'icontags' => $icon_tags, 'mypath' => $this->_path )); $this->context->controller->addCSS($this->_path . 'views/css/tagsicons.css'); return $this->display(__FILE__, 'views/templates/hook/tagsicons.tpl'); } and then i just hooked the module to displayProductBeforeData on the back office. the module is desplayed exactly where i want it but it is all messed up! is if there is no css loaded! for example the icons are verticaly aligned instead of horizontaly. now when i hook the module in displayRightColumnProduct it looks great also above the datasheet. as you can see here: can someone help me fix this? thank you! Link to comment Share on other sites More sharing options...
haimbilia Posted April 11, 2016 Author Share Posted April 11, 2016 anyone? can you give me a hint on where to look please? Link to comment Share on other sites More sharing options...
shokinro Posted April 11, 2016 Share Posted April 11, 2016 the HTML elements in your hook will inherits CSS style from parent element you hooked to, you will need create new CSS style or adjust the existing CSS style to adjust the layout of elements in your hook. Link to comment Share on other sites More sharing options...
haimbilia Posted April 11, 2016 Author Share Posted April 11, 2016 the css works just fine if i manually include it in the header. the problem is it is not being included unless i hook the module in displayRightColumnProduct as you can see in the picture. also if i hook it to displayProductTab it works fine. so i believe i need to change something the product.tpl Link to comment Share on other sites More sharing options...
shokinro Posted April 11, 2016 Share Posted April 11, 2016 Not sure if I understand your problem correctly. You can override setMedia() method of ProductController.php so that you can include the CSS style for your hook. You can directly include the CSS for your hook inside your theme file of your hook. 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