0

How to show the product attribute in the Product listing page i had used the helper in Magento_Catalog (Magento_Catalog/templates/product/list.phtml) but it gives the value of the product attribute not label the attribute type is Dropdown.

$this->helper('Magento\Catalog\Helper\Output');
$_helper->productAttribute($_product, $_product->getManufacturer(), 'manufacturer');

I got the out as 5755

I want to get the value using above method how can we do this.

Thanks in Advance:)

1

Method 1:

echo $_product->getAttributeText('manufacturer'); 

Method 2:

$manufacturer = $_product->getResource()->getAttribute('manufacturer');
echo $manufacturer->getFrontend()->getLabel($_product);
| improve this answer | |
  • if it is in XML how can i get this – Sabareesh May 6 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.