문제

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

도움이 되었습니까?

해결책

Method 1:

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

Method 2:

$manufacturer = $_product->getResource()->getAttribute('manufacturer');
echo $manufacturer->getFrontend()->getLabel($_product);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top