akt
akt

Reputation: 759

Magento:how to get manufacturer name in Product page?

I want to display manufacturer name in product/view.phtml .I have all used all sort of functions like

<?php echo $_product->getAttributeText('manufacturer');?>
<?php echo $this->htmlEscape($_product->getData('manufacturer'));
<?php echo $_product->getData('manufacturer'); ?>

But none of them helped.So how to get manufacturer name in product view page .

Upvotes: 13

Views: 35954

Answers (8)

Stephan
Stephan

Reputation: 27

manufacturer (and all other attributes) is part of the optionslist, which is accessible by getOptionsList.

Try this snippet:

<?php
     $_options = $this->getOptionList();
     echo $_options['manufacturer']['value'];
?>

Upvotes: 0

Alex
Alex

Reputation: 1

$_product->getAttributeText('country_of_manufacture');

Upvotes: -1

John
John

Reputation: 1

<?php 
  echo $_helper->productAttribute($_product, $_product->getManufacturer(), 'manufacturer') 
?>

Upvotes: 0

Andrew
Andrew

Reputation: 12809

As mentioned above you will need to follow a few steps:

1) goto Attribute Sets, and make sure "manufacturer" is assigned to the attribute set you are using.

2) Make sure you have added some manufacturers into the attribute options.

3) Assign one of the options to your product.

Depending on your magento version this should work:

<?php echo $_product->getAttributeText('manufacturer') ?>

I can see the error you are getting:

gives error Call to a member function getManufacturer() on a non-object in 

Are you sure you are putting this code after this line:

<?php $_product = $this->getProduct(); ?>

Upvotes: 24

Palanikumar
Palanikumar

Reputation: 1746

Make sure the following things 1. Your attribute code is "manufacturer". 2. "Manufacturer" attribute is added to your attribute set. 3. You have chosen attribute values in admin catalog product. 4. That corresponding product is visible on frontend.

If all the 4 points are yes your code should work.

Upvotes: 1

Kenny
Kenny

Reputation: 5400

Make sure that the "Used in product listing" option for the manufacturer attribute has been set to "Yes".

After that you should be able to do

$_product->getManufacturer();

Upvotes: -1

ThreeCheeseHigh
ThreeCheeseHigh

Reputation: 1498

Try:

$_procuct->getManufacturer();

Upvotes: 0

Mufaddal
Mufaddal

Reputation: 5381

you can use something like this to get manufacture name

$_product->getResource()->getAttribute('manufacture')->getFrontend()->getValue($_product);

Upvotes: 1

Related Questions