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

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

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare