如何在magento中获取属性组 [英] how to get the attribute group in magento

查看:102
本文介绍了如何在magento中获取属性组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取某个属性集的属性组,我该怎么做?

I need to get the attribute group of a certain attribute set , how can i do this ?

我认为我获得了属性组ID,但似乎无法获得该组的属性.

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

    }  

如果有人可以帮助我,我将非常感激,thanx;)

I would really appreciate if somebody could help me out , thanx ;)

推荐答案

只需使用ID即可实例化所需的模型.

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);
}

这篇关于如何在magento中获取属性组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆