gennybeans Posted October 20, 2011 Share Posted October 20, 2011 Hi, So I've run into a bit of a jam with the Top Horizontal Menu v1.3. I am using this module to link to CMS pages. But I would love to be able to create parent and child menus. For Example: About Us (parent) History (child) Mission(child) Is there any way to do this with this module? And I know a lot of people have suggested Julien's other module, but I have tried it, and it doesn't seem to be working nicely with my breadcrumbs (the breadcrumbs line seems to push above the menu). Any help would be amazing! Thank you. Link to comment Share on other sites More sharing options...
saviorho Posted October 25, 2011 Share Posted October 25, 2011 same question!!! Link to comment Share on other sites More sharing options...
AnilaN Posted October 25, 2011 Share Posted October 25, 2011 Hi, I don't know about this module but you might want to have a look at the module jbx_menu. It is really easy to use and offers what you are looking for.You can see it in the attachment Link to comment Share on other sites More sharing options...
gennybeans Posted November 9, 2011 Author Share Posted November 9, 2011 Hi aany, Thank you for your suggestion. I've read other people suggest it as well, but because I'm using the Matrice theme, the menu doesn't really sit well with the design for some reason. I was hoping for a possible solution for the Top Horizontal Menu v1.3, which is the menu that the theme was made with. Link to comment Share on other sites More sharing options...
sofcik Posted December 5, 2011 Share Posted December 5, 2011 I had the same problem and modified the module to be able to show CMS menu items in submenus according to their CMS category. You will be able to add CMS categories to menu in back office. You need to add the following code to blocktopmenu.php: - after: // END Manufacturer - insert: // BEGIN CMSCategories $this->_html .= '<optgroup label="'.$this->l('CMS Categories').'">'; $this->getCMSCategoryOption(1, $cookie->id_lang); $this->_html .= '</optgroup>'; // END CMSCategories -after: case'CAT': $this->getCategoryOption($id, $cookie->id_lang, false); break; put: case'CMC': $this->getCMSCategoryOption($id, $cookie->id_lang, false); break; - after: case'CAT': $this->getCategory($id, $cookie->id_lang); break; put: case'CMC': $this->getCMSCategory($id, $cookie->id_lang); break; - and finally at the end append these two functions: private function getCMSCategoryOption($id_category, $id_lang, $children = true) { $categorie = new CMSCategory($id_category, $id_lang); if(is_null($categorie->id)) return; if(count(explode('.', $categorie->name)) > 1) $name = str_replace('.', '', strstr($categorie->name, '.')); else $name = $categorie->name; $this->_html .= '<option value="CMC'.$categorie->id.'" style="margin-left:'.(($children) ? round(15+(15*(int)$categorie->level_depth)) : 0).'px;">'.$name.'</option>'; if($children) { $childrens = CMSCategory::getChildren($id_category, $id_lang); if(count($childrens)) foreach($childrens as $children) $this->getCMSCategoryOption($children['id_cms_category'], $id_lang); } } private function getCMSCategory($id_category, $id_lang) { global $page_name; $categorie = new CMSCategory($id_category, $id_lang); if(is_null($categorie->id)) return; //$selected = ($page_name == 'category' && ((int)Tools::getValue('id_category') == $id_category)) ? ' class="sfHoverForce"' : ''; $selected = ''; $this->_menu .= '<li'.$selected.'>'; if(count(explode('.', $categorie->name)) > 1) $name = str_replace('.', '', strstr($categorie->name, '.')); else if($categorie->name!='') $name = $categorie->name; else $name = 'Home'; $this->_menu .= '<a href="'.$categorie->getLink().'">'.$name.'</a>'; $childrens = CMSCategory::getChildren($id_category, $id_lang); $pages = CMSCore::getCMSPages($id_lang,$id_category); if(count($childrens) || count($pages)) { $this->_menu .= '<ul>'; foreach($childrens as $children) $this->getCMSCategory($children['id_cms_category'], $id_lang); foreach($pages as $page) { $selected = ($page_name == 'cms' && (Tools::getValue('id_cms') == $id)) ? ' class="sfHover"' : ''; $cms = CMS::getLinks($id_lang, array($page['id_cms'])); if(count($cms)) $this->_menu .= '<li'.$selected.'><a href="'.$cms[0]['link'].'">'.$cms[0]['meta_title'].'</a></li>'.PHP_EOL; } $this->_menu .= '</ul>'; } $this->_menu .= '</li>'; } I attached modified blocktopmenu.php. I hope you'll find it useful. Best regards, Przemek blocktopmenu.php 3 Link to comment Share on other sites More sharing options...
gennybeans Posted December 14, 2011 Author Share Posted December 14, 2011 @sofcik Hey! Thank you so much for posting that! In the back-end, it seems to be working quite nicely. The options are there. But even after saving the menu items I create, nothing changes on the front-end. Is there anything in the .tpl file that I also need to change in order for changes to take effect? Thanks for your help! Link to comment Share on other sites More sharing options...
chuvachon Posted January 28, 2012 Share Posted January 28, 2012 i didn't find any other way - changed blocktopmenu.php back ... I've created in CMS module new category and internal pages . And than wrote manually code in blocktopmenu.tpl like <LI><a>category</a></li><ul><li>.....</li></ul> etc. The way it should be((( So it let me add one more tab to the top menu.. ( Link to comment Share on other sites More sharing options...
gennybeans Posted February 23, 2012 Author Share Posted February 23, 2012 Yeah, I have also manually just added menu items through the template files. Seems to work fine for now. Link to comment Share on other sites More sharing options...
publitesa Posted March 2, 2012 Share Posted March 2, 2012 Thanks a lot sofcik! It runs for me. Link to comment Share on other sites More sharing options...
GrinReaper Posted April 2, 2012 Share Posted April 2, 2012 Hello, I'm not just a noob but NOT a coder either, so I have no idea where to insert this <LI><a>category</a></li><ul><li>.....</li></ul> etc. The way it should be(((" blocktopmenu.tpl has 22 lines and have no idea where to insert this code. <LI><a>category</a></li><ul><li>.....</li></ul> etc. <---does this means I have to add as many as <li> as needed? I have 37 links that I need to show in my dropdown menu, meaning I need to show 37 <li> ? thanks! Link to comment Share on other sites More sharing options...
microblog Posted June 12, 2012 Share Posted June 12, 2012 same problem for me. multilanguage web site and i need to put a multi category with the cms but i can't Link to comment Share on other sites More sharing options...
webtintin Posted December 12, 2012 Share Posted December 12, 2012 GREAT !! Thanks, webtintin Link to comment Share on other sites More sharing options...
Alexis rechh Posted January 18, 2014 Share Posted January 18, 2014 BEST MODULE EVER !! Thx 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