Author: wang

Non classé

create filter by attribute (my code)

$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'forme_shape'); foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) { // $myArray] = $instance; //$productCollection_shape= $category_shape=Mage::getModel('catalog/category')->load($idcats); $productCollection_qty = $category_shape->getProductCollection() ->addAttributeToSelect(array('name', 'forme_shape')) ->addAttributeToFilter('forme_shape', array('eq' =>$instance )) ->count(); //print_r($productCollection_qty); if($productCollection_qty>0) { $myArray] = $instance; } } //print_r($myArray);