Reputation: 8704
I want to get a list of names of attributes from attribute set. I know how to get attribute IDs, but I can't figure out how to get list of names. This is my code so far.
<?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);
}
?>
Upvotes: 0
Views: 160
Reputation: 248
Did some testing myself and seem to have done it now,
foreach($attributes as $_attribute){
$attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
->setCodeFilter($_attribute['code'])
->getFirstItem()->getFrontendLabel();
echo "<pre>";
echo $attributeInfo;
}
Upvotes: 1