Get Attributes by attribute group name in magento

Sometimes, we need to create attribute group for additional information to show on product detail page or needed to create attributes for sidebar filters on product listing page. Here in this post, I am going to share with you some lines of codes that will surely help you to call/show additional information group attributes on your product detail page.

         $setId = $_product->getAttributeSetId();
         $additional_info = Mage::getModel('eav/entity_attribute_group')
        foreach ($additional_info as $info):
        if($info->getAttributeGroupName() == 'Additional Information'){ 
            $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
            if ($attributes->getSize() > 0) {
            <div class="box-collateral box-additional">
            <h2><?php echo $this->__('Additional Information') ?></h2>
            <table class="data-table" id="product-attribute-specs-table">
            <col width="25%" />
            <col />
            foreach ($attributes->getItems() as $attribute) {
                <th class="label"><?php echo $attribute->getFrontendLabel(); ?></th>
                <td class="data"><?php $attr_val = Mage::getModel('catalog/product')
                        if(is_array($attr_val)){echo implode(",",$attr_val);}else{echo $attr_val;} ?></td>
            <?php }?>
            <script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
        <?php }} endforeach; ?>

Here In this tutorial, I have created an attribute set with the name ‘Additional Information’ and added the attributes in this attribute set. And then applied to this sets on my products. Note that attribute sets can only be applied while adding new products. If you have already created your products then you have to delete your existing product then recreate all your products by choosing your needed attribute set.

I hope this simple tutorial will help. Thank you reading my post. Please write your opinion in the comment box below or if you encountered any issues while working on attribute sets then feel free to ask your questions in the comment box below.


  1. Replies
    1. If you want to show attributes on product detail page.