【问题标题】:List manufacturers with products in category in Magento?在 Magento 中列出产品类别的制造商?
【发布时间】:2012-12-11 04:54:04
【问题描述】:

我正在尝试列出(带有链接)具有特定类别产品的所有制造商。这有效:

            $category           = 56;
            $layer = Mage::getModel("catalog/layer");
            $layer->setCurrentCategory($category);
            $attributes = $layer->getFilterableAttributes();
            $manufacturers = array();
            foreach ($attributes as $attribute) {
                if ($attribute->getAttributeCode() == 'manufacturer') {
                    $filterBlockName = 'catalog/layer_filter_attribute';
                    $result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
                    foreach($result->getItems() as $option) {
                        echo '<li><a href="'.$this->getUrl('').'bats.html?manufacturer=' .$option->getValue().'">'.$option->getLabel().'</a></li>';
                    }
                }
            }

但是当我在制造商类别页面之一时,属性链接消失了。我假设是因为它使用了分层导航模型。

在不使用分层导航模型的情况下,是否可以获取特定类别的制造商列表?

【问题讨论】:

    标签: php sql magento attributes categories


    【解决方案1】:

    您好,我认为您创建了新的自定义模块并将 xml 标签从 catalog.xml 覆盖到您的布局 xml

    /app/design/frontend/base/default/layout/catalog.xml

    使用左/右/内容等参考名称调用制造块

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-20
      • 2011-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-01
      • 1970-01-01
      相关资源
      最近更新 更多