Magento从外部脚本获取可用的属性集ID和名称

Wil*_*ile 6 php magento magento-1.7

我尝试了各种各样的东西,但我没有到达任何地方.请有人告诉我如何获取所有可用产品属性集的名称和ID?一个是'默认'......

我正在构建一个自定义引用系统,需要引入属性集,以便用户可以先选择,然后加载分配给该集的产品.

非常感谢您的帮助.

The*_*res 12

您可以使用以下命令加载属性集:

$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection') ->load();
Run Code Online (Sandbox Code Playgroud)

重复:

foreach ($attributeSetCollection as $id=>$attributeSet) {
  $entityTypeId = $attributeSet->getEntityTypeId();
  $name = $attributeSet->getAttributeSetName();
  Mage::log("ATTRIBUTE SET :".$name." - ".$id);
}
Run Code Online (Sandbox Code Playgroud)

然后,您可以按属性集加载集合.