Domanda

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

È stato utile?

Soluzione

Method 1:

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

Method 2:

$manufacturer = $_product->getResource()->getAttribute('manufacturer');
echo $manufacturer->getFrontend()->getLabel($_product);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top