how to get the all attributes that belongs to a attribute group in magento

前端 未结 1 710
梦谈多话
梦谈多话 2021-01-21 21:24

I have an attribute group and I want to get the list of attributes that belongs a particular attribute group. Is there any way to get all of the attributes under an attribute gr

相关标签:
1条回答
  • 2021-01-21 22:02

    Works on Mage 1.7.0.0:

    function printGroupAttributes($groupId) {
        $attributesCollection = Mage::getResourceModel('catalog/product_attribute_collection');
            $attributesCollection->setAttributeGroupFilter($groupId);
            foreach ($attributesCollection as $attribute) {
               echo $attribute->getAttributeCode()."<br/>"; // I launch it from browser
            }
    }
    $attributeGroupId = 534; // Fill with yours
    printGroupAttributes($attributeGroupId);
    

    Source: Mage_Catalog_Model_Product_Attribute_Group->hasConfigurableAttributes()

    0 讨论(0)
提交回复
热议问题