Ecommerce Developer
 
 

Top Navigation Questions...

 

Hi everyone,

It's me again (whoo-hoo!) with more questions (aw...). Here's what I'm trying to do:

I have some categories and sub-categories and sub-sub-categories. Ex:

Root Category

and so on...

I would like all of those categories to show up (be 'active') – except for the Root Category (which doesn't, as expected) – but I want some categories to only be text and not be anchors (links to the said category). Using the above example, I don't want an anchor on the following categories:

This is what I did: I duplicated the following file: app > code > core > Mage > Catalog > Block > Navigation.php

into this location:

app > code > local > Mage > Catalog > Block > Navigation.php

Then, I replaced this code:

$html.= ''.$this->htmlEscape($category->getName()).''."\n";

with this:

if($category->getId()=='mycategorynumber'): $html.= ''.$this->htmlEscape($category->getName()).''."\n"; else: $html.= ''.$this->htmlEscape($category->getName()).''."\n"; endif;

Obviously I'm doing something wrong because otherwise I wouldn't be writing this. It's not working, even after refreshing the cache. Then I tried replacing that same line with: $html.= ''.$this->htmlEscape($category->getName()).' testing'."\n";

to see if that was gonna change anything in my top navigation, and you guessed it: fail. big time. nothing happens. The top navigation stays the same.

So I'm guessing (emphasis on 'guessing') that I AM changing the right file, BUT: 1) I'm not placing the file in the right location. 2) $category->getId() is not how I get the category number. 3) Maybe there's some XML that I need to edit as well?

Does anyone know: 1) Where I need to place Navigation.php? 2) If my PHP correct? 3) Anything else that could help me out?

If you're still reading, thank you for still being here, and for your help.

Regards, jm

Twitter: @jmbuytaert

1 Answer