Knowledge Base

Help, guides and FAQ about Magikcommerce.

How to Get Custom Attribute Value in Magento?

In Magento merchant might need to add attributes to describe products, such as shape or volume. A merchant can add these attributes on the admin panel, and these attributes can be displayed.So you have created some custom attributes for your Magento products and now you want to fetch their values.Below are the steps to create the custom attribute values in product details page and list page.

To display a custom product attribute on the product list page

Go Admin -> Catalog -> Attributes -> Manage Attributes > Set "Used in Product Listing" to Yes

To display a custom product attribute on the product detail page

Go Admin -> Catalog -> Attributes -> Manage Attributes > Set "Visible on Product View Page on Front-end" to Yes

Below are the steps to show the custom attribute values in product details page and list page.

$_product->getData('attribute_code');
Ex:- $strProdSkuSup = $product->getData('sku_supplier'); 

Magento translates snake_case into camelCase when you want to use the magic getters; ie. an attribute with the attribute code new_custom_attribute would translate into newCustomAttribute, i.e. $product->getNewCustomAttribute()

Ex:- $strProdSkuSup = $product->getSkuSupplier();

If you face any problems or need our professional services, please email us at [email protected]