此解决方案适用于 Magento -1.8.*
在模型文件中。(/app/code/core/Mage/Catalog/Model/Observer.php)
更新函数名称中的以下代码:_addCategoriesToMenu
$categoryData = array(
'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()
);
然后进入 Html 文件夹。(app/code/core/Mage/Page/Block/Html/Topmenu.php)
在第 128 行更新以下代码行
函数名:_getHtml
$urls = Mage::getBaseUrl('media').'catalog/category/'.$child->getData('thumbnail');
$img = '<img src="'.$urls.'" />';
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'
. $this->escapeHtml($child->getName()) . ' </span> '.$img.' </a>';