Php 如何从属性集中获取属性名称列表
我想从属性集中获取属性名称的列表。我知道如何获取属性ID,但我不知道如何获取名称列表。这是到目前为止我的代码Php 如何从属性集中获取属性名称列表,php,magento,Php,Magento,我想从属性集中获取属性名称的列表。我知道如何获取属性ID,但我不知道如何获取名称列表。这是到目前为止我的代码 <?php $entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId(); $attributeSetName = 'Brands'; $attributeSetId = Mage::getModel('eav/entity
<?php
$entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
$attributeSetName = 'Brands';
$attributeSetId = Mage::getModel('eav/entity_attribute_set')
->getCollection()
->setEntityTypeFilter($entityTypeId)
->addFieldToFilter('attribute_set_name', $attributeSetName)
->getFirstItem()
->getAttributeSetId();
$attributes = Mage::getModel('catalog/product_attribute_api')->items($attributeSetId);
foreach($attributes as $_attribute){
var_dump($_attribute);
}
?>
我自己做了一些测试,现在似乎已经做了
foreach($attributes as $_attribute){
$attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
->setCodeFilter($_attribute['code'])
->getFirstItem()->getFrontendLabel();
echo "<pre>";
echo $attributeInfo;
}
foreach($attributes作为$\u属性){
$attributeInfo=Mage::getResourceModel('eav/实体\属性\集合')
->setCodeFilter($\u属性['code'])
->getFirstItem()->getFrontendLabel();
回声“;
echo$attributeInfo;
}