====== Hide navigation items with CSS ====== __Note: You'll lost update functionality or have to modify changed files by hand. I'll post an update with an overwrite of the method the upcoming week!__ I made a small modification on method drawItem(). The rendered source will give out an individual id for each point in navigation, so this is a small hide-by-css hack. **app/code/core/Mage/Catalog/Block/Navigation.php, around Line 134** **Replace** /** * Enter description here... * * @param Mage_Catalog_Model_Category $category * @param int $level * @param boolean $last * @return string */ public function drawItem($category, $level=0, $last=false) { $html = ''; if (!$category->getIsActive()) { return $html; } $children = $category->getChildren(); $hasChildren = $children && $children->count(); $html.= 'isCategoryActive($category)) { $html.= ' active'; } if ($last) { $html .= ' last'; } if ($hasChildren) { $cnt = 0; foreach ($children as $child) { if ($child->getIsActive()) { $cnt++; } } $html .= ' parent'; } $html.= '">'."n"; $html.= ''.$category->getName().''."n"; //$html.= ''.$level.''; if ($hasChildren){ $j = 0; $htmlChildren = ''; foreach ($children as $child) { if ($child->getIsActive()) { $htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt); } } if (!empty($htmlChildren)) { $html.= ''; } } $html.= ''."n"; return $html; } **With** /** * Enter description here... * * @param Mage_Catalog_Model_Category $category * @param int $level * @param boolean $last * @return string * modified for css hide by jan212@05.05.2008 */ public function drawItem($category, $level=0, $last=false) { $html = ''; if (!$category->getIsActive()) { return $html; } $children = $category->getChildren(); $hasChildren = $children && $children->count(); $html.= 'getID(); // $html.= ' class="level'.$level; // if ($this->isCategoryActive($category)) { $html.= ' active '; } if ($last) { $html .= ' last'; } if ($hasChildren) { $cnt = 0; foreach ($children as $child) { if ($child->getIsActive()) { $cnt++; } } $html .= ' parent'; } //modified for css hide from jan212 $html.= '" id="nav-'.$level.'-'.$cid.'">'."n"; // $html.= ''.$this->htmlEscape($category->getName()).''."n"; //$html.= ''.$level.''; if ($hasChildren){ $j = 0; $htmlChildren = ''; foreach ($children as $child) { if ($child->getIsActive()) { $htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt); } } if (!empty($htmlChildren)) { $html.= ''; } } $html.= ''."n"; return $html; } No you’ll see e.g. something like
  • point. **To hide the navigation entry (for human eyes only) simply create new entries in menu.css like this** /* css hide from horizontal navigation */ #nav-0-5 {display:none;} /*examples hides category 5 @ level 0 */ #nav-1-6 {display:none;} /*examples hides category 6 @ level 1*/ __Remember: Every ID is unique__ Regards Jan Fervers