显示Magento类别图像

Cha*_*ung 0 magento magento-1.4

通常,顶部菜单会列出子类别的名称,我想列出子类别的图像.任何人都可以建议PHP代码.

谢谢

Iva*_*nyi 7

可以通过config.xml将附加属性添加到前端类别属性加载列表中来完成:

<frontend>
    <category>
        <collection>
            <attributes>
                 <[attribute_code] />
            </attributes>
        </collection>
    </category>
</frontend>
Run Code Online (Sandbox Code Playgroud)

只需替换[attribute_code]为图像属性代码(可能在您的情况下image)

然后您将能够访问类别图像$category->getImage(),也可能需要覆盖Mage_Catalog_Block_Navigation块以自定义html格式化菜单.

完成此自定义后,请不要忘记清除缓存并重建平面类别索引(如果已使用).