Magento: Get list of all manufacturers

Manufacturer is a core product attribute in Magento. This article shows how you can fetch the manufacturer attribute and all it’s option value and id.

Here is the code to list all the option values of manufacturer attribute:


/** 
 * Get list of all manufacturers
 */
$_productId = 11; // Your Product ID
$_product = Mage::getModel('catalog/product')->load($_productId);
	
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
                  ->setEntityTypeFilter($_product->getResource()->getTypeId())
                  ->addFieldToFilter('attribute_code', 'manufacturer');

$attribute = $attributes->getFirstItem()->setEntity($_product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);

// print manufacturers array
echo "<pre>"; print_r($manufacturers); echo "</pre>";

Update:

Here is another way to get manufacturer attribute option values:


$attribute = Mage::getResourceModel('eav/entity_attribute_collection')
                  ->addFieldToFilter('attribute_code', 'manufacturer');

// print manufacturer attribute data
echo '<pre>'; print_r($attribute->getData());

$attributeValue = Mage::getResourceModel('eav/entity_attribute_option_collection')
						->setAttributeFilter($attribute->getData('attribute_id'))
						->setStoreFilter(0, false);

// print manufacturer attribute option value data
echo '<pre>'; print_r($attributeValue->getData());

Hope it helps. Thanks.