1

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:)

2
  • check this image nimb.ws/1k6HdE this is yes or not ??? May 6, 2020 at 5:06
  • @Mohit Patel all the options are Yes only
    – Sabareesh
    May 6, 2020 at 5:19

1 Answer 1

3

Method 1:

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

Method 2:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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