在品红中按属性按颜色筛选产品的代码


code to filter product by attribute by color in magento

我需要按颜色,大小列表页面实现产品过滤器。我已经创建了一个超级菜单,并想实现这一点。

有任何想法,如何解决这个问题?

您可以使用代码实现,例如

$productCollection =Mage::getModel('catalog/product')->getCollection()
                           ->addAttributeToFilter('color',{{color-option-id}})
                           ->addAttributeToFilter('size',{{size-option-id}});

其他过滤器选项可以在https://www.magentocommerce.com/wiki/1_-_installation_and_configuration/using_collections_in_magento

中找到

这是通过代码,如果你正在谈论分层导航,那么http://www.magentocommerce.com/knowledge-base/entry/how-does-layered-navigation-work

请让我知道这是否有效!