Magento 分层导航和类别子菜单

Magento 分层导航和类别子菜单,magento,Magento,我有一个网站的顶级分类菜单,当你悬停时,它会显示一个子菜单,有两列:“按类别”和“按品牌” 目前,“按类别”可以完美地显示子类别列表,但“按品牌”有一个缺陷。当未按任何品牌过滤时,显示品牌列表,但当我在分层导航或子菜单(这是分层导航过滤器的链接)中选择一个品牌时,品牌停止显示 如何在每个子菜单中显示品牌列表?不是所有的品牌都有每个类别的结果,这就是为什么我使用分层导航过滤代码 这是catalog/navigation/top.phtml的代码: <?php $layer = Mage::g

我有一个网站的顶级分类菜单,当你悬停时,它会显示一个子菜单,有两列:“按类别”和“按品牌”

目前,“按类别”可以完美地显示子类别列表,但“按品牌”有一个缺陷。当未按任何品牌过滤时,显示品牌列表,但当我在分层导航或子菜单(这是分层导航过滤器的链接)中选择一个品牌时,品牌停止显示

如何在每个子菜单中显示品牌列表?不是所有的品牌都有每个类别的结果,这就是为什么我使用分层导航过滤代码

这是catalog/navigation/top.phtml的代码:

<?php
$layer = Mage::getSingleton('catalog/layer');
$brands = array();
$_childCategory = Mage::getModel('catalog/category')->setStoreId($storeId)->load($categoryChildId);
$layer->setCurrentCategory($_childCategory);

$attributes = $layer->getFilterableAttributes();
foreach ($attributes as $attribute) {
    if ($attribute->getAttributeCode() == 'brand') {
        $result = Mage::app()->getLayout()
                ->createBlock('catalog/layer_filter_attribute')
                ->setLayer($layer)
                ->setAttributeModel($attribute)
                ->init();

        foreach ($result->getItems() as $option) {
            $brands[$option->getValue()] = $option->getLabel();
        }
    }
}
var_dump($brands);