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

不打扰是莪最后的温柔 提交于 2019-12-02 06:47:36

问题


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 group?


回答1:


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()



来源:https://stackoverflow.com/questions/10898607/how-to-get-the-all-attributes-that-belongs-to-a-attribute-group-in-magento

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!