Skip to content

Instantly share code, notes, and snippets.

@aurire
Created April 16, 2016 18:24
Show Gist options
  • Save aurire/c81d212bd5e243d7211c4df309ccf710 to your computer and use it in GitHub Desktop.
Save aurire/c81d212bd5e243d7211c4df309ccf710 to your computer and use it in GitHub Desktop.
Magento. Delete attribute set by attribute set name
$entityTypeId = Mage::getModel('eav/entity')
->setType('catalog_product')
->getTypeId();
$attributeSetName = 'My New Set';
$attributeSetId = Mage::getModel('eav/entity_attribute_set')
->getCollection()
->setEntityTypeFilter($entityTypeId)
->addFieldToFilter('attribute_set_name', $attributeSetName)
->getFirstItem()
->getAttributeSetId();
Mage::getModel("eav/entity_attribute_set")->load($attributeSetId)->delete();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment