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

brentwpeterson
6,1348 gold badges45 silver badges81 bronze badges
asked Jan 3, 2015 at 13:21
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. Commented 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

answered May 29, 2015 at 7:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.