【问题标题】:Magento - Get Manufacturer attribute's value List, Even if any Manufacturer is selected as filterMagento - 获取制造商属性的值列表,即使选择任何制造商作为过滤器
【发布时间】:2013-11-21 20:39:55
【问题描述】:

我正在使用 Magento 1.7

我想获取制造商属性的值列表,即使选择任何制造商作为过滤器

如果我的类别页面是例如说: http://www.magento.com/index.php/categoryPage.html?manufacturer=145

我无法在此特定页面上获取“制造商”属性值的列表。

由于制造商作为查询字符串传递,它将被选为过滤器。 但无论如何我都需要这份清单。

当我使用 filter.phtml 中的代码时,我在日志中收到错误消息:

“您不能多次定义关联名称‘manufacturer_idx’”

我怎样才能做到这一点?

【问题讨论】:

    标签: magento filter attributes magento-1.7


    【解决方案1】:

    您可以检查当前网址是否包含制造商,然后在列表页面上您可以使用以下代码过滤具有制造商属性的产品

    $manufacturerId = 3; $attributeCode = '制造商';

    $products = Mage::getModel('catalog/product')->getCollection() ->addAttributeToFilter($attributeCode, $manufacturerId);

    所以它会显示包含制造商属性的产品列表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-09
      • 2021-10-13
      相关资源
      最近更新 更多