We can use the following code to get the list of manufacturers in MAGENTO.
$product = Mage::getModel('catalog/product');
//Retriving the attribute values for the manufacturer id
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', 'manufacturer') // This can be changed to any attribute code
->load(false);
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
//This is an array of manufacturers
$manufacturers = $attribute->getSource()->getAllOptions(false);
No comments:
Post a Comment