$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);
Day: January 13, 2015
magento
magento: get all attribute options
Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code); $options = $attribute_details->getSource()->getAllOptions(false);