B-219 Sec-55 Noida, India
+918010221733

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;

(Visited 61 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.