且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取Magento中的产品系列,并按类别&过滤自定义属性值

更新时间:2023-11-30 12:20:40

<?php
// load category object by category ID
$category = Mage::getModel('catalog/category')->load(1);

// get product collection, filter it by category, 
// add the color attribute to select to be able to filter using it later
$productCollection = Mage::getResourceModel('catalog/product_collection')
                       ->addCategoryFilter($category)
                       ->addAttributeToSelect('color')
                       ->addFieldToFilter(array(
                           array('attribute'=>'color','eq'=>'white'),
                       ));

更多信息检查

如何从特定商品获取产品magento电子商务中的类别

Magento-检索具有特定属性值的产品

https://magento.stackexchange.com/questions/5838 /get-product-collection-from-a-category-id