====== 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.= '
**With**
'."n"
.$htmlChildren
.'
';
}
}
$html.= '
/**
* 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.= '
No you’ll see e.g. something like
'."n"
.$htmlChildren
.'
';
}
}
$html.= '
in the rendered source of your page menu, e.g. for category 5 like above.
The id is based on the following sheme: nav(prefix)-x(Level)-xxxx(Unique Category ID) and inserted to every
/* 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