I would like to show the various attributes divided into groups as created in the set of attributes, such as

  • general
    • attribute 1
    • attribute 2
    • ...
  • other info
    • attribute 1
    • attribute 2
    • ...

How do I retrieve the attribute groups and their labels?

or is there a module to do this?



Try this:

require_once 'app/Mage.php';

$attributeGroupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection');

foreach ($attributeGroupCollection as $attributeGroup) {
  echo "\n\nGroup Name: " . $attributeGroup->getAttributeGroupName();
  echo "\nGroup ID: " . $attributeGroup->getAttributeGroupId();

  $attributeCollection = Mage::getResourceModel('eav/entity_attribute_collection')

  foreach($attributeCollection as $attribute) {
    echo "\n\t Attribute Frontend Label: " . $attribute->getFrontendLabel();
    echo "\n\t Attribute Name: " . $attribute->getName();

You get:

Group Name: Design
Group ID: 37
         Attribute Fontend Label: Custom Design
         Attribute Name: custom_design
         Attribute Fontend Label: Active From
         Attribute Name: custom_design_from
         Attribute Fontend Label: Active To
         Attribute Name: custom_design_to
         Attribute Fontend Label: Custom Layout Update
         Attribute Name: custom_layout_update
         Attribute Fontend Label: Page Layout
         Attribute Name: page_layout
         Attribute Fontend Label: Display Product Options In
         Attribute Name: options_container

Group Name: Recurring Profile
Group ID: 38
         Attribute Fontend Label: Enable Recurring Profile
         Attribute Name: is_recurring
         Attribute Fontend Label: Recurring Profile
         Attribute Name: recurring_profile

Group Name: Images
Group ID: 39
         Attribute Fontend Label: Base Image
         Attribute Name: image
         Attribute Fontend Label: Small Image
         Attribute Name: small_image
         Attribute Fontend Label: Thumbnail
         Attribute Name: thumbnail
         Attribute Fontend Label: Media Gallery
         Attribute Name: media_gallery
         Attribute Fontend Label: Image Gallery
         Attribute Name: gallery
         Attribute Fontend Label: Swatch Color
         Attribute Name: swatch_color

Group Name: Meta Information
Group ID: 40
         Attribute Fontend Label: Meta Title
         Attribute Name: meta_title
         Attribute Fontend Label: Meta Keywords
         Attribute Name: meta_keyword
         Attribute Fontend Label: Meta Description
         Attribute Name: meta_description

You can then build upon this to get attribute values/options as well. Hope this helps.

  • Hi Oleg, your suggest show all attibute, but I want show only some group set of attribute. – Joso Sep 21 '14 at 15:40
  • @Joso then simply filter the collection by what groups you want to show :) – David Manners Sep 24 '14 at 13:23
  • Hi, unfortunately I'm not a programmer, I only know a few commands / scripts php and html and I could not do what you described. But I thought if the various attributes can be retrieved in some way in the file .phtml without having to modify the php strength relative to that function. for example: <? php echo $ _helper-> productAttribute ($ product, ($ _product-> getDescription2 ()), 'description2')?> – Joso Sep 25 '14 at 16:12
  • I want to show attribute group name in product page, can you tell me where should I copy this code? thanks – Elham Gdz Jul 28 '15 at 7:31

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.