Blog

Get Custom Attribute on Product List with Flat Catalog

Blog / Magento

Get Custom Attribute on Product List with Flat Catalog

$_getMyAttr = $_product->getResource()->getAttribute(‘my_attribute’);

// Get Value
$attrTestValue = $_getMyAttr->getFrontend()->getValue($_product);

// Get Label
$attrTestLabel = $_getMyAttr->getStoreLabel();
Important
Make sure “Visible on Product View Page on Front-end” and “Used in Product Listing” options under storefront Properties are set to Yes.

Leave your thought here

Η ηλ. διεύθυνση σας δεν δημοσιεύεται. Τα υποχρεωτικά πεδία σημειώνονται με *