PipBoy2000 Posted May 13, 2015 Share Posted May 13, 2015 (edited) Hi all! Im struggling with implementation of Bootstrap navbar to work with standard Prestashop 1.5.6.2 BlockTopMenu module (top main menu). Overall its work good but the subcategories are not. Here is my piece of code: private function getCategory($id_category, $id_lang = false, $id_shop = false) { $id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()->language->id; $category = new Category((int)$id_category, (int)$id_lang); if ($category->level_depth > 1) $category_link = $category->getLink(); else $category_link = $this->context->link->getPageLink('index'); if (is_null($category->id)) return; $children = Category::getChildren((int)$id_category, (int)$id_lang, true, (int)$id_shop); $selected = ($this->page_name == 'category' && ((int)Tools::getValue('id_category') == $id_category)) ? '' : ''; $is_intersected = array_intersect($category->getGroups(), $this->user_groups); // filter the categories that the user is allowed to see and browse if (!empty($is_intersected)) { $this->_menu .= '<li '.$selected.' class="dropdown">'; $this->_menu .= '<a class="dropdown-toggle" data-toggle="dropdown" href="'.Tools::HtmlEntitiesUTF8($category_link).'" aria-expanded="false">'.$category->name.'</a>'; if (count($children)) { $this->_menu .= '<ul class="dropdown-menu">'; foreach ($children as $child) $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); $this->_menu .= '</ul>'; } $this->_menu .= '</li>'; } } And the compiled code looks like here <ul class="nav navbar-nav"> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Category" data-toggle="dropdown">Category</a> <ul class="dropdown-menu"> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Subcategory" data-toggle="dropdown">Subcategory</a> </li> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Subcategory" data-toggle="dropdown">Subcategory</a> </li> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Subcategory" data-toggle="dropdown">Subcategory</a> </li> </ul> </li> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Category" data-toggle="dropdown">Category</a> <ul class="dropdown-menu"> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Subcategory" data-toggle="dropdown">Subcategory</a> </li> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Subcategory" data-toggle="dropdown">Subcategory</a> </li> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Subcategory" data-toggle="dropdown">Subcategory</a> </li> <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Subcategory" data-toggle="dropdown">Subcategory</a> </li> </ul> </li> Main problem is that subcategory links are li dropdowns and i cant go to this link to view subcategory page. This should looks like here but i cant make it work (im not php programmer) <li class="dropdown"> <a class="dropdown-toggle" aria-expanded="false" rel="nofollow" href="Category" data-toggle="dropdown">Category</a> <ul class="dropdown-menu"> <li> <a rel="nofollow" href="Subcategory">Subcategory</a> </li> <li> <a rel="nofollow" href="Subcategory">Subcategory</a> </li> <li> <a rel="nofollow" href="Subcategory">Subcategory</a> </li> <li> <a rel="nofollow" href="Subcategory">Subcategory</a> </li> </ul> </li> Any help much appreciated and will be donated (PayPal)! Here is StackOverflow thread http://stackoverflow.com/questions/30211584/how-to-implement-bootstrap-navbar-to-standard-prestashop-blocktopmenu-module Edited May 13, 2015 by PipBoy2000 (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