1

I want to show category(subcategory) image beside my main navigation dropdown. I have tried with following script

I just copied the Observer.php and Navigation.php from app\code\core\Mage\Catalog\

to my local(app\code\local\Mage\Catalog)

and in observer.php i added the line in function(_addCategoriesToMenu)

$categoryData = array(
                'image_url' => $category->getThumbnail(),
                 'name' => $category->getName(),
                'id' => $nodeId,
                 'url' => Mage::helper('catalog/category')->getCategoryUrl($category),
                'is_active' => $this->_isActiveMenuCategory($category),                 'thumbnail' => Mage::getModel('catalog/category')->load($category->getId())->getThumbnail()
             );

and in navigation.php (_renderCategoryMenuItemHtml)

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

I can not found the image url by this function $category->getThumbnail();

How do i fetch the image url to show in navigation dropdown

1
  • I can't seem to get getThumbnail() to work at all in Magento 1.9 :/ Surprised more people haven't noticed this and discussed it on here.
    – zigojacko
    Mar 9, 2015 at 14:07

1 Answer 1

1

Starting version 1.7 the top menu is not rendered anymore using _renderCategoryMenuItemHtml.
The menu is a general block Mage_Page_Block_Html_Topmenu where you can add anything, not only categories using the event page_block_html_topmenu_gethtml_before.
The menu is rendered by the method _getHtml from the class mentioned above

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.