Thanks for the tip Tzyganu… I’m having sort of a similar issue.
Currently I have a custom left.phtml navigation template for our store at the top of the file I have:
$_base_url = $this->helper('core/url')->getHomeUrl();
$category = Mage::registry('current_category')->getId();
I then have a ul/li sprite with different hover states that I set as active if a user is on a specific category page:
<a class="<?php if($category == 35) echo "on"; ?>" href="<?php echo Mage::getModel("catalog/category")->load(35)->getUrl() ?>" title="<?php echo $this->__('Link Title')?>"><span>Category 35</span></a>
I noticed that the catalog search results were breaking due to the lack of catalog being set. This is also happening on my product view pages. I’d like it to show the product’s parent category as class="on" to show an active state for my li button, but don’t know what php coding is needed to find the product’s category id.
Thanks for any help.