Magento – Remove View All menu link only for specific categories RWD theme 1.9

menurendererrwd

How do I remove view all for one specific category only? These categories do not have children which I think is the problem.

I tried editing renderer.phtml at line 62 with this if statement but it still shows for my category id 3.

if ($_catid = $this->getCategoryid('3')) {}
                            else {
        if (!empty($_hasChildren)) {
            $html .= '<ul class="level'. $childLevel .'">';
            $html .=     '<li class="level'. $nextChildLevel .'">';                      
            $html .=         '<a class="level'. $nextChildLevel .'" href="'. $child->getUrl() .'">';
            $html .=             $this->__('View All')/* . $this->escapeHtml($this->__($child->getName()))*/;
            $html .=         '</a>';
            $html .=     '</li>';
            $html .=     $this->render($child, $childrenWrapClass);
            $html .= '</ul>';
        }

    }

Best Answer

The reason is that the menu has no idea about the category id. It is simply a node tree. What you could do is take the value of $child->getId() and extract the id from it. This id value should look something like category-node-12 where 12 is the category id.

Though I would maybe suggest that though this would be a fairly "easy" change it is not that flexible and you should really look into how the menu is built.

Another possible idea is to use the event page_block_html_topmenu_gethtml_before and unset the children for your desired category here.