Skip to main content
4 of 5
added 331 characters in body
marc
  • 11
  • 1
  • 4

Echo custom attribute with getResource() ->getAttribute

I'm trying to show all available sizes for one product on list.phtml

I've set up a custom attribute size_age (id:142) but when I try use the code

$attributeLabel = $customer->getResource() ->getAttribute('size_age') ->getFrontend() ->getAttribute() ->getFrontendLabel();

I get this error:

Fatal error: Call to a member function getResource() on null


UPDATE:

thank you for your answers. I changed the code to:

$attributeLabel = $_product->getResource() ->getAttribute('size_age') ->getFrontend() ->getAttribute() ->getFrontendLabel();

I dont have any error right now.

But I dont get any output. I'm trying to echo all available sizes for the product.

marc
  • 11
  • 1
  • 4