Thursday, July 18, 2013

Magento Category Navigation With Image or thumbnail

If you want to display Navigation with image,
I am sure this post will helpful to you,

Go to this location app\code\core\Mage\Catalog\Model\Observer.php

Find this function in this file _addCategoriesToMenu($categories, $parentCategoryNode)
and add image and thumbnail value

                'image' => $category->getImageUrl('image'),
                'thumbnail' => Mage::getModel('catalog/category')->load($category->getId())->getThumbnail(),

on $categoryData array,

after add this code you require 1 more edit as your requirement you need to add this code on Menu related Php file,
if you want thumbnail image so call getThumbnail() function otherwise use getImage()
            $thumbnailUrl = Mage::getBaseUrl('media').'catalog/category/'.$child->getThumbnail();
         and append  $thumbnailUrl to your html variable.

Thats it save your file and refresh page, you will see image on navigation.