- System Attributes
- Custom Attributes
System Attributes: By default, Magento includes all the necessary System Attributes.
Following are the system attributes:
System Attributes | How to call system attribute in phtml file? |
---|---|
country_of_manufacture | $_product->getCountryOfManufacture(); |
custom_design | $_product->getCustomDesign(); |
custom_design_from | $_product->getCustomDesignFrom(); |
custom_design_to | $_product->getCustomDesignTo(); |
custom_layout_update | $_product->getCustomLayoutUpdate(); |
description | $_product->getDescription(); |
enable_googlecheckout | $_product->getAttributeText(“enable_googlecheckout”); |
gift_message_available | $_product->getAttributeText(“gift_message_available”); |
group_price | $_product->getGroupPrice(); |
image | $_product->getImage(); |
is_recurring | $_product->getAttributeText(“is_recurring”); |
meta_description | $_product->getMetaDescription(); |
meta_keyword | $_product->getMetaKeyword(); |
meta_title | $_product->getMetaTitle(); |
msrp | $_product->getMsrp(); |
msrp_display_actual_price_type | $_product->getAttributeText(“msrp_display_actual_price_type”); |
msrp_enabled | $_product->getAttributeText(“msrp_enabled”); |
Custom Attributes: Custom attributes are those attributes which is created by the user that is called user-defined attributes.
How to create custom product attributes and product attribute set?
- A) How to create new attribute?
Go to Admin Catalog → Attributes → Manage Attributes
- Click on Add New Attribute
- Set Attribute Code and Manage label
- After that, Click on Save Attribute
- B) How to create new product attribute set?
Go to Admin Catalog → Manage Attribute Set
- Click on Add New Set
- Add name and Click on Add Attribute Set
- C) How to assign new attribute to any attribute set?
- 1] Suppose, We assign new attribute to Shoes attribute set
- 2] Then edit Shoes Attribute set and Our new attribute present in unassigned
- 3] Attribute’s list Drag and Drop in Groups After that, click on Save Attribute set
How to get custom attribute value
eg: arribute code = date_attribute$_dateValue = $_product->getDateAttribute();
echo $_dateValue;
eg: arribute code = price_attribute$_priceValue = $_product->getPriceAttribute();
echo $_priceValue;
eg: arribute code = yesno_attribute$_yesNoValue = $_product->getAttributeText(yesno_attribute);
echo $_yesNoValue;
eg: arribute code = dropdown_attribute$_dropDown = $_product->getAttributeText(dropdown_attribute);
echo $_dropDown;