I need to get the attribute group of a certain attribute set , how can i do this ?
i think i got the attribute group id but i can't seem to get the attributes of that group.
$attributes = $_product->getAttributes();
foreach($attributes as $attribute)
{
$group_id = $attribute->getData('attribute_set_info/' . $_product->getAttributeSetId() . '/group_id');
print_r($group_id);
}
I would really appreciate if somebody could help me out , thanx ;)
Just use the ID to instantiate the model you want.
$product = Mage::getModel('catalog/product')->getCollection()->getFirstItem();
foreach($product->getAttributes() as $att)
{
$group_id = $att->getData('attribute_group_id');
//Mage_Eav_Model_Entity_Attribute_Group
$group = Mage::getModel('eav/entity_attribute_group')->load($group_id);
var_dump($group);
}
You can try this, will return all Attribute Group of Magento
$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_group_collection')
->load();
foreach ($attributeSetCollection as $id=>$attributeGroup) {
echo 'group-name: '; echo $attributeGroup->getAttributeGroupName();
echo '<br>';
echo 'group-id: '; echo $attributeGroup->getAttributeGroupId();
echo '<br>';
echo 'set-id: '; echo $attributeGroup->getAttributeSetId();
echo '<br>';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With