How to disable root category links in Magento

Hi everybody,

Sorry if the answer is out there somewhere, I have search forever for it.
Is it possible to disable the root category links and just have the sub category links in the drop downs?
I’ve been spending hours turning in to days on this!  You may look at

the top nav links, I want them not to be clickable, but just have the drop downs appear instead.

Thanks so much for any help!

Kasonde NeddyDesigner & DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The links are created in a block, you will need to edit the block and just not wrap the 1st level categories in an anchor tag.

The file you need to update is /app/code/core/Mage/Catalog/Block/Navigation.php

In the _renderCategoryMenuItemHtml function you will see that this is where the links are built.
You should see code simmilar to:
$html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
        $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
        $html[] = '</a>';

Open in new window

Just update the above code to somthing like this:
if($level == 0){
//first level
$html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
} else {
//Origional code if not 1st category level.
$html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
$html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
$html[] = '</a>';

Open in new window

That should get what you wanted.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kasonde NeddyDesigner & DeveloperAuthor Commented:
Worked like a charm!!!

Thanks so much miked2004
Kasonde NeddyDesigner & DeveloperAuthor Commented:
Simple and straight-forward to implement! :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Components

From novice to tech pro — start learning today.