获取分配给属性组的所有属性

时间:2012-10-16 19:23:50

标签: php magento attributes

我正在研究magento的导入模块。我需要找出属性是否属于属性组。我已加载属性以及属性组。我试过了:

$attributeCollection = $attributeGroup->getAttributes();

理论是我可以查看集合,并确定该属性是否已分配给属性组。

1 个答案:

答案 0 :(得分:0)

您可以从属性中获取组ID,并在重新安装时加载组。

$product = Mage::getModel('catalog/product')->load(ID_HERE);
foreach($product->getAttributes() as $attribute)
{
    $groupId = $attribute->getAttributeGroupId();
}

如果您想加载群组模型:

$group = Mage::getModel('eav/entity_attribute_group')->load($groupId);