Magento : Getting a Product’s Manufacturer Name instead ID

Home / Blog / Magento / Magento : Getting a Product’s Manufacturer Name instead ID

If you have every done this:


$_product = Mage::getModel('catalog/product')->load(__PRODUCT_ID__);
$manufacturer = $_product->getManufacturer();

You’ll know that you get the manufacturer’s id instead of it’s name. Which may or may not be what you would have expected. But the product model provides a nice helper method for getting an attributes value, in case it was not what you were expecting. Below is the code to get a product’s manufacturer name instead of it’s ID.


$_product = Mage::getModel('catalog/product')->load(__PRODUCT_ID__);
$manufacturer = $_product->getAttributeText('manufacturer');

Showing 2 comments
  • Harry Pierson

    Thanks, just what I was looking for.

    Harry

  • Ruiwant

    That’s exactly what I need. Thank you very much!

Leave a Comment