I added a custom field to product in admin panel named vendor_name
So I wanna get value of this field by do something like
$_product->getVendorName()
Like what I can do with non eav attribute (i.e $product->getSku()
)
But $_product->getVendorName()
give me null
value ,
What is the best solution to get attribute ? I wanna same syntax for both eav and None eav attribute.
Best Answer
In Store > Attributes > Product > YOUR ATTRIBUTE > Storefront Properties set Visible on Catalog Pages on Storefront and Used in Product Listing to TRUE.
In your code you can use:
or