2013-10-11 79 views
0

我使用下面的代码过滤用颜色属性来配置产品颜色属性,但它给空数组的Magento ::如何通过过滤器在Magento

$visibility = array(
         Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, 
         Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG 
       ); 
$cur_category=Mage::getModel('catalog/category')->load($cat_id); 
$_productCollection= Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->getCollection() 
                     ->addAttributeToSelect('*') 
                     ->addAttributeToFilter('visibility', $visibility); 
$_productCollection->addAttributeToFilter('color', 146); 

请告诉我

回答

0

你的代码是100 %正确,我觉得还有一些其他问题,请检查其他部分。如果您只是提取没有类别的产品而不是删除此行

$cur_category=Mage::getModel('catalog/category')->load($cat_id);