php - Magento Programming: Getting list of all Manufacturers and corresponding Manufacturer ID -


i need coding. need list of manufacturers corresponding magento id. possible? please help. thanks. tried mods 1 or other. if possible, pls w/ 1 last thing. thank in advance

$attribute = mage::getmodel('eav/config')->getattribute('catalog_product', 'manufacturer');  foreach ( $attribute->getsource()->getalloptions(true, true) $option){      $attributearray[$option['value']] = $option['label'];      }    foreach($attributearray $key=>$val){ echo $val;  } 

not sure format require in following example should illustrate how values need:

$attribute = mage::getmodel('eav/entity_attribute')                 ->loadbycode('catalog_product', 'manufacturer');  $valuescollection = mage::getresourcemodel('eav/entity_attribute_option_collection')             ->setattributefilter($attribute->getdata('attribute_id'))             ->setstorefilter(0, false);  $preparedmanufacturers = array();             foreach($valuescollection $value) {     $preparedmanufacturers[$value->getoptionid()] = $value->getvalue(); }      if (count($preparedmanufacturers)) {     echo "<h2>manufacturers</h2><ul>";     foreach($preparedmanufacturers $optionid => $value) {         echo "<li>" . $value . " - (" . $optionid . ")</li>";     }     echo "</ul>"; } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -