Magento Forum

navigation bar, how to make top level category not clickable
 
liqinwei
Jr. Member
 
Total Posts:  6
Joined:  2010-11-25
 

i want to make category on top level not clickable, but dropdown list clickable, just like top navbar on this page, ‘Resources’, ‘Download’, ‘Customers’ not clickable.
i found below thread, but didn’t work out for me, can anyone help me?
http://www.magentocommerce.com/boards/viewthread/57701/#

 
Magento Community Magento Community
Magento Community
Magento Community
 
ravemaster
Jr. Member
 
Total Posts:  9
Joined:  2010-06-19
 

You have to edit Navigation.php from the Mage folder.

// assemble list item with attributes
        $htmlLi '<li';
        foreach (
$attributes as $attrName => $attrValue{
            $htmlLi 
.= ' ' $attrName '="' str_replace('"''\"'$attrValue) . '"';
        
}
        $htmlLi 
.= '>';
        
$html[] $htmlLi;

        
$html[] '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
        
$html[] '<span>' $this->escapeHtml($category->getName()) . '</span>';
        
$html[] '</a>';

Try change to

// assemble list item with attributes
        $htmlLi '<li';
        foreach (
$attributes as $attrName => $attrValue{
            $htmlLi 
.= ' ' $attrName '="' str_replace('"''\"'$attrValue) . '"';
        
}
        $htmlLi 
.= '>';
        
$html[] $htmlLi;

    if (
$level===0){
        $html[] 
'<a href="[removed]:void(0)"'.$linkClass.'>';
    
}
    else{
        $html[] 
'<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
    
}
        $html[] 
'<span>' $this->escapeHtml($category->getName()) . '</span>';
        
$html[] '</a>';

Then you can use css to style the cursor

Replace [removed] with

javascript
 
Magento Community Magento Community
Magento Community
Magento Community
 
liqinwei
Jr. Member
 
Total Posts:  6
Joined:  2010-11-25
 

hi master, below is part of css file, how should i change cursor? many thanks!
and when mouse over, the color will change, how to make the color to stay put?

/********** < Navigation */
.nav-container {}
#nav { border:1px solid #ddd; padding:5px 0; margin:10px 0; font-size:13px; }

/* All Levels */
#nav li { text-align:left; position:relative; }
#nav li.over { z-index:998; }
#nav li.parent {}
#nav li a { display:block; text-decoration:none; }
#nav li a:hover { text-decoration:none; }
#nav li a span { display:block; white-space:nowrap; cursor:pointer; }
#nav li ul a span { white-space:normal; }

/* 1st Level */
#nav li { float:left; }
#nav li a { float:left; padding:5px 10px; font-weight:bold; color:#888; }
#nav li a:hover { color:#000; }
#nav li.over a,
#nav li.active a { color:#000; }

/* 2nd Level */
 
Magento Community Magento Community
Magento Community
Magento Community
 
brunomarshall
Guru
 
Avatar
Total Posts:  367
Joined:  2009-08-04
 
liqinwei - 28 November 2010 01:26 AM

i want to make category on top level not clickable, but dropdown list clickable, just like top navbar on this page, ‘Resources’, ‘Download’, ‘Customers’ not clickable.
i found below thread, but didn’t work out for me, can anyone help me?
http://www.magentocommerce.com/boards/viewthread/57701/#

Hello ,
You can do this by removing is anchored in backend property as no this will affetct layered navigation of category if you are not need of layered navigation then you can go by making is anchored property to no

 
Magento Community Magento Community
Magento Community
Magento Community
 
ravemaster
Jr. Member
 
Total Posts:  9
Joined:  2010-06-19
 
liqinwei - 29 November 2010 05:55 AM

hi master, below is part of css file, how should i change cursor? many thanks!
and when mouse over, the color will change, how to make the color to stay put?

/********** < Navigation */
.nav-container {}
#nav { border:1px solid #ddd; padding:5px 0; margin:10px 0; font-size:13px; }

/* All Levels */
#nav li { text-align:left; position:relative; }
#nav li.over { z-index:998; }
#nav li.parent {}
#nav li a { display:block; text-decoration:none; }
#nav li a:hover { text-decoration:none; }
#nav li a span { display:block; white-space:nowrap; cursor:pointer; }
#nav li ul a span { white-space:normal; }

/* 1st Level */
#nav li { float:left; }
#nav li a { float:left; padding:5px 10px; font-weight:bold; color:#888; }
#nav li a:hover { color:#000; }
#nav li.over a,
#nav li.active a { color:#000; }

/* 2nd Level */

Try this

#nav li.parent:hover{
cursor:pointer;
color:#888;
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
furnitureforyoultd
Enthusiast
 
Total Posts:  833
Joined:  2009-03-09
 

How could you set an exemption based on category id?

We’d like to block top level links on some categories but not others.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

what happens when you click the show in navigation?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Magazento
Sr. Member
 
Avatar
Total Posts:  155
Joined:  2010-01-08
Russia,Volgograd
 

please take a look at Megamenu extension
Megamenu

 
Magento Community Magento Community
Magento Community
Magento Community
 
freelancerpush
Jr. Member
 
Total Posts:  16
Joined:  2009-03-15
Indore, India
 

Navigatin.php is located here app/code/core/Mage/Catalog/Block/Navigation.php

 
Magento Community Magento Community
Magento Community
Magento Community
 
markstains1
Jr. Member
 
Total Posts:  1
Joined:  2012-08-24
 

Can some one suggest me the best ways to learn CCS scripting.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

I think you mean CSS, right? Maybe this: http://www.w3schools.com/css/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  639
Joined:  2009-08-22
 

Hello,

As the matter of fact the current menu system of Magento is not very convenient. It does not allow you to change the menu structure, add the own links or change the markup.
Consider the Menu Manager Pro. This extension simplifies the creation of menus of different types with different structure significantly.

 
Magento Community Magento Community
Magento Community
Magento Community
 
x613513
Jr. Member
 
Total Posts:  10
Joined:  2009-12-25
 

http://stackoverflow.com/questions/19473982/magento-how-to-make-a-parent-menu-link-which-has-subcategories-not-clickable

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top