如何将制造商属性添加到 magento 分层导航中的筛选结果



我正在使用Magento企业版,默认情况下,我在左侧导航栏中获取类别和价格范围,同时按类别显示产品列表。

但是,我需要添加其他产品属性,例如制造商、转移类型...到筛选器结果是分层导航。

我能够在该制造商属性下显示制造商列表,但带有"无结果过滤器"选项,计数为 0。

每当我在管理端将制造商属性的选项更改为Catalogue/Attributes/Manage Attributes下的'Filter with results'时,我都无法在前端左侧导航栏中看到该属性。

即使有很多产品与制造商的。我需要对代码进行任何更改吗,请帮助我,我是这个 magento 平台的新手。

谢谢

抱歉,

如果听起来是一个愚蠢的问题,但您更改了类别配置,请参阅在 YES 中定位?

我会在回答后及时通知您

最好杭德罗

在 你的

:洋红色/应用程序/代码/核心/法师/目录/块/导航.php

public function getAllManu()
 {
        $product = Mage::getModel('catalog/product');
        $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
        ->setEntityTypeFilter($product->getResource()->getTypeId())
                ->addFieldToFilter('attribute_code', 'manufacturer'); //can be changed to any attribute
        $attribute = $attributes->getFirstItem()->setEntity($product->getResource());
        $manufacturers = $attribute->getSource()->getAllOptions(false);
        return $manufacturers;
    }

现在在位置添加 phtml 文件:magento/app/design/frontend/mytheme/default/template/catalog/navigation/left_nav.phtml

<?php foreach ($this->getAllManu() as $manufacturer): ?>
                <li>
                    <a href="catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a>
                </li>
<?php endforeach;?>

只需调用block:magento/app/design/frontend/mytheme/default/layout/catalog.xml

<reference name="left">
            <block type="catalog/navigation" name="catalog.leftnavigation" template="catalog/navigation/left_nav.phtml"/>
</reference>

最新更新