Reputation: 759
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
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
Reputation: 1
<?php
echo $_helper->productAttribute($_product, $_product->getManufacturer(), 'manufacturer')
?>
Upvotes: 0
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
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
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
Reputation: 5381
you can use something like this to get manufacture name
$_product->getResource()->getAttribute('manufacture')->getFrontend()->getValue($_product);
Upvotes: 1