{"id":1032,"date":"2015-07-28T19:52:41","date_gmt":"2015-07-28T19:52:41","guid":{"rendered":"http:\/\/invisiblezero.net\/?p=1032"},"modified":"2024-07-22T09:31:18","modified_gmt":"2024-07-22T09:31:18","slug":"magento-simple-code-snippet-to-remove-redundant-attribute-from-cli","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/magento-simple-code-snippet-to-remove-redundant-attribute-from-cli\/","title":{"rendered":"Magento – Simple code snippet to remove redundant attribute from CLI"},"content":{"rendered":"
if you want to do something like this :<\/p>\n
\nphp -f remove_redundant_attribute.php\n<\/pre>\nin order to remove redundant attributes, then this article is for you \ud83d\ude42 . yes, i know that Magento setup script is a headache sometime.<\/p>\n
<\/p>\n
to do it, you just need to use the code snippet below for your ‘remove_redundant_attribute.php’ file<\/p>\n
\n&lt;?php\n$mageFilename = getcwd() . '\/app\/Mage.php';\n\nif (!file_exists($mageFilename)) {\n echo 'Mage file not found';\n exit;\n}\nrequire $mageFilename;\nMage::setIsDeveloperMode(true);\numask(0);\nMage::app();\nMage::app()-&gt;setCurrentStore(Mage::getModel('core\/store')-&gt;load(Mage_Core_Model_App::ADMIN_STORE_ID));\n\n$installer = Mage::getResourceModel('catalog\/setup', 'core_setup');\n\/\/ remove the redundant attributes here\ntry {\n $installer-&gt;removeAttribute('catalog_product','seo_category');\n}\ncatch (Exception $e) {\n echo $e-&gt;getMessage(); die;\n}\n<\/pre>\nto remove more attributes, please add more ‘$installer->removeAttribute(‘catalog_product’,’seo_category’);’<\/p>\n
i hope you will find this article useful for you.<\/p>\n","protected":false},"excerpt":{"rendered":"
if you want to do something like this : php -f remove_redundant_attribute.php in order to remove redundant attributes, then this article is for you \ud83d\ude42 . yes, i know that Magento setup script is a headache sometime. to do it, you just need to use the code snippet below for your ‘remove_redundant_attribute.php’ file &lt;?php $mageFilename…<\/p>\n