Magento Themes and Magento Extensions

Get all attributes from an attribute set in magento.

Share

Get all attributes from an attribute set in magento.

$entityTypeId = Mage::getModel(‘eav/entity’)
->setType(‘catalog_product’)
->getTypeId();
$attributeSetName = ‘Default’; //Edit with your required Attribute Set Name
$attributeSetId = Mage::getModel(‘eav/entity_attribute_set’)
->getCollection()
->setEntityTypeFilter($entityTypeId)
->addFieldToFilter(‘attribute_set_name’, $attributeSetName)
->getFirstItem()
->getAttributeSetId();
$attributesInfo = Mage::getResourceModel(‘eav/entity_attribute_collection’)
->setEntityTypeFilter($attributeSetId) //4 = product entities
->addSetInfo()
->getData();
foreach($attributesInfo as $attribute):
$attributeObj = Mage::getModel(‘eav/entity_attribute’)->load($attribute['attribute_id']);

echo $attribute['frontend_input'];echo ‘<br/>’;
echo ‘label = ‘.$attributeObj->getFrontendLabel().’<br/>’;
echo ‘code = ‘.$attributeObj->getAttributeCode().’<br/><br/>’;
endforeach;

Comments are closed.