问题
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