Magento:如何获取属于属性集的属性? [英] Magento: how to get the attributes that belong to an attribute set?

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

问题描述

具有属性集,如何获得它包含的属性的列表(或者更好的是,不属于默认属性集的自定义属性)?

Having an attribute set, how can I get a list of the attributes it contains (or better yet, just the custom attributes that don't belong to the Default attribute set)?

可以通过多种方式获取属性集本身,例如:

The attribute set itself can be obtained in several ways, such as:

$entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
$attributeSet = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter($entityTypeId)->addFilter('attribute_set_name', 'Default');

请注意,我需要使用属性集,因此从产品中获取属性列表不是我要寻找的解决方案.

Note that I need to use the attribute set, so getting the list of attributes from a product is not the solution I am looking for.

推荐答案

我相信答案就在于此模型

I believe the answer lies in this model

Mage::getModel('catalog/product_attribute_set_api')->items($setId);

该类是Mage_Catalog_Model_Product_Attribute_Api,它似乎有两个方法. items()方法似乎可以满足您的要求,即 从指定的属性集中检索属性"

The class is Mage_Catalog_Model_Product_Attribute_Api it seems to have two methods. The items() methods seems to do what you ask i.e. "Retrieve attributes from specified attribute set"

我希望对您有所帮助:)

I hope that helps :)

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

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