Wednesday, May 29, 2013

Magento : How to remove any attribute from category programatically

Here is the simple code for deleting any category attribute using the simple lines of code.
[php]

require_once("app/Mage.php");
Mage::app('default');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('catalog_category');

$setup->removeAttribute($entityTypeId,'display_mode');

[/php]

This could be usefull if you added some custom attribute and want to remove them back.

Happy coding :-)

No comments:

Post a Comment