oslayer Posted October 21, 2012 Share Posted October 21, 2012 I need to set the maximum depth for top horizontal menu items. Presta 1.5.1, the standard module blocktopmenu, based on superfishmenu. How to do it? Depth should not depend on the settings of the module blockcategories. Help please... Link to comment Share on other sites More sharing options...
theme_designer Posted October 22, 2012 Share Posted October 22, 2012 PM us. We will give you a quota. Link to comment Share on other sites More sharing options...
oslayer Posted October 22, 2012 Author Share Posted October 22, 2012 who knows how to solve this problem? Link to comment Share on other sites More sharing options...
Wynn Posted October 22, 2012 Share Posted October 22, 2012 (edited) * Removed Flawed Code * Edited October 22, 2012 by Wynn (see edit history) Link to comment Share on other sites More sharing options...
oslayer Posted October 22, 2012 Author Share Posted October 22, 2012 (edited) It worked but very strange i have this string if(count($children) & $category->level_depth < 4 ) and see result in my website chemirus.tmweb.ru menu with a depth of 3 is not displayed at all And see blocktopmenu.php in attach blocktopmenu.php Edited October 22, 2012 by oslayer (see edit history) Link to comment Share on other sites More sharing options...
oslayer Posted October 22, 2012 Author Share Posted October 22, 2012 In modules/blocktopmenu/blocktopmenu.php Inside the function getCategory, around line 645 you should see this code: if (!empty($is_intersected)) { $this->_menu .= '<li '.$selected.'>'; $this->_menu .= '<a href="'.$category_link.'">'.$category->name.'</a>'; [b]if (count($children))[/b] { $this->_menu .= '<ul>'; foreach ($children as $child) $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); $this->_menu .= '</ul>'; } $this->_menu .= '</li>'; } } If i replace line with code if (count($children)) on this if(count($children) & ($ddd=1)) i have menu depth with one sub-level but those who have depth 3 or 2 do not show any sub-levels (no 1 or 2 or 3 sub-level menu and items) If i replace line with code if (count($children)) on this if(count($children) & ($ddd=2)) i have menu depth with two sub-level but those who have depth 1 do not show how to combine the conditions? Link to comment Share on other sites More sharing options...
Abhishek Gupta Posted July 13, 2013 Share Posted July 13, 2013 In modules/blocktopmenu/blocktopmenu.php Inside the function getCategory, around line 645 you should see this code: if (!empty($is_intersected)) { $this->_menu .= '<li '.$selected.'>'; $this->_menu .= '<a href="'.$category_link.'">'.$category->name.'</a>'; [b]if (count($children))[/b] { $this->_menu .= '<ul>'; foreach ($children as $child) $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); $this->_menu .= '</ul>'; } $this->_menu .= '</li>'; } } If i replace line with code if (count($children)) on this if(count($children) & ($ddd=1)) i have menu depth with one sub-level but those who have depth 3 or 2 do not show any sub-levels (no 1 or 2 or 3 sub-level menu and items) If i replace line with code if (count($children)) on this if(count($children) & ($ddd=2)) i have menu depth with two sub-level but those who have depth 1 do not show how to combine the conditions? Hey i,m facing kinda same problem. i don't want any subcategories. I mean zero level. Do you know how to do it ? Link to comment Share on other sites More sharing options...
PrestAlec Posted November 16, 2020 Share Posted November 16, 2020 Hello! I have posted this in other thread which discuss same problem: FIXED In the Top Menu I needed to limit the Categories detail level to 1. I'm no expert coder at all, so please be kind... may be I performed major surgery instead being a bit more gentle 🙃 -- PS ver 1.7.6.8 -- File modules/ps_mainmenu/ps_mainmenu.php -- Line 715 protected function "generateCategoriesMenu" -- Disabled (commented) lines 746 to 761 as follows /*if (isset($category['children']) && !empty($category['children'])) { $node['children'] = $this->generateCategoriesMenu($category['children'], 1); if ($this->imageFiles === null) { $this->imageFiles = scandir(_PS_CAT_IMG_DIR_); } if (count(preg_grep('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $this->imageFiles)) > 0) { foreach ($this->imageFiles as $file) { if (preg_match('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $file) === 1) { $image_url = $this->context->link->getMediaLink(_THEME_CAT_DIR_.$file); $node['image_urls'][] = $image_url; } } } }*/ -- Advanced Parameters, Performance, Smarty -> Save -- Just in case, hit "Clear Cache" top right button -- Tested, Worked for me! Hope this can help. 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