So I created a custom attribute, shipping, which is a drop down menu taking on three possible values. In its attribute settings I set the field Used in Product Listing to 'Yes', did a reindexation, and now it is correctly added in the products' flat table catalog_product_flat_1 such that I have the attribute_id field called shipping and its value shipping_value.

Now in the frontend product page (view) I am trying to access the value of shipping_value but only shipping (the id of the attribute) is loaded in my current product - so it doesn't work..

It looks like Magento only loads a subset of the flat table columns into the product object. But I can't find where this is defined.

How can I load my flat table column shipping_value + value into my product so I can use it in my frontend view?

Edit: I want to avoid doing another database lookup on the product view page. I'd like to just access the data like $product->getShippingValue().

  • How to print in frontend update your code
    – Magento 2
    Nov 9, 2016 at 19:02
  • try this <?php echo nl2br($_product->getResource()->getAttribute('Your_attribute_id')->getFrontend()->getValue($_product)); }?>
    – Magento 2
    Nov 9, 2016 at 19:04
  • Thanks @Kothari but I want to avoid the database lookup. The data should be in the products data array rather than me having to fetch it again.
    – Pitt
    Nov 9, 2016 at 19:07

1 Answer 1


So I ended up using the following code on my product view page to get the text value of the attribute shipping:


Which seems to load the attribute from the loaded data of the product or if it doesn't find the attribute with that key it looks it up in the eav attributes table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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