I have created an extension that creates a category attribute when installed first time. But now when I disable/Uninstall the extension, I get an error message on "Manage Categories" page.
I know that when an Extension is disabled via Magento connect, only files are deleted and nothing is deleted from database.
So, In order to overcome this problem can we provide a button to delete database entries that can be placed under system configuration section along with other setting of extension. And when admin clicks on that button all database entries should be deleted along with files used by extension.
Please let me know if above solution will work? or is there any better solution in order to delete unwanted entries from database while uninstalling extension.
Best Answer
You could create an uninstall shell script that lives in the
shell/
folder. That file can remove files, directories, database tables,core_resource
entries, and attributes from EAV.It would look something like this:
You can run it on the command line with:
Once that's done, you can delete the shell file itself.