更新时间: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'),
));
更多信息检查
https://magento.stackexchange.com/questions/5838 /get-product-collection-from-a-category-id