我需要获取某个属性集的属性组,我该怎么做?
我想我得到了属性组ID,但我似乎无法获得该组的属性.
$attributes = $_product->getAttributes();
foreach($attributes as $attribute)
{
$group_id = $attribute->getData('attribute_set_info/' . $_product->getAttributeSetId() . '/group_id');
print_r($group_id);
}
Run Code Online (Sandbox Code Playgroud)
我真的很感激,如果有人可以帮助我,thanx;)
只需使用ID来实例化您想要的模型.
$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);
}
Run Code Online (Sandbox Code Playgroud)