Jump to content

Change Horizental Menu Depth to 3 level


Recommended Posts

I want to modify Horizontal Menu as it shows categories up to depth 4, which makes it too big, I want to change the depth to 3 so that it will look nice,

 

my current menu is attached

you can use this code:

 

#block_top_menu ul li li li ul {display:none!important;}

paste this code to your styleseet file (global.css)

 

in addition i see that you use ccc for css files 

in this case you have to clear cache after change tpl/css files.

 

effect:

k7areHr.png

 

based on:

hide subcategories in block top menu

  • Like 3
Link to comment
Share on other sites

#block_top_menu ul li li li ul {display:none!important;} 

this code just hide all <ul> (listings) of categories

 

li - first element

li li - second element

li li li - third element 

 

so this code hide all of category listings above the 3 level

  • Like 1
Link to comment
Share on other sites

#block_top_menu ul li li li ul {display:none!important;} 

this code just hide all <ul> (listings) of categories

 

li - first element

li li - second element

li li li - third element 

 

so this code hide all of category listings above the 3 level

 

 

Firstly I want to add 1 thing:

 

#block_top_menu ul li  selector will work on #block_top_menu ul li li too.

If you want to select 1 level below you should use #block_top_menu ul > li

 

Secondly: In my opinion this solution is not good enough because you shouldn't hide any navigation elements (its bad for SEO)

 

EDIT:

So I still waiting for 'number of levels' input in module.

Edited by falkor (see edit history)
Link to comment
Share on other sites

 

 

Secondly: In my opinion this solution is not good enough because you shouldn't hide any navigation elements (its bad for SEO)

as far as i know browsers can't distinct if an <ul> or any other element is hidden by jquery/css styles (display:none)

This "display:none" works the same as it works in native, see - whole default top menu sub items are also hidden, only if you hover mouse over it (menu items) it is visible (dispaly:block) - it's not true that it's bad for seo.

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...

Hi 

 

I found a solution for your issue. 

Try this

 

open blockmenutop.php

go to function generateCategoriesMenu

 

find this block

 

if (isset($category['children']) && !empty($category['children']))
{
}
 
now add this block inside the following condition
 
 
 
if($category['level_depth'] <=2){
    if (isset($category['children']) && !empty($category['children']))
   {
   }
}
 
save file, clear cache and reload your store home page
Link to comment
Share on other sites

in my opiniton it's not worth to deal with .tpl file

these categories will not be included to page, so these categories will not be visible, it's like a suicide related to seo cases.

 

with css these links will be still there.

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...