Using the Yireo Delete-Any-Order module
The Yireo Delete-Any-Order module is a commercial module sold by Yireo through the online shop (based on MageBridge) and allows to delete orders with any status, including orders with the status completed. By doing so, the module also needs to remove other so-called EAV-entities from the database (shipping information, applied taxes, ordering items, etcetera), so the functionality is more complex than it seems.
This is why we recommend following the steps in this tutorial for safely using this module. The usage of the module is mostly straight forward, but we'd like to point out the importance of a proper database backup as well.
Backing up the database
Using this module, you will delete vital information from the Magento database. In case of emergency (when things go wrong or you make a mistake) you should always have a backup, ready to be restored. Make sure you have made a valid backup and make sure you know how to restore this backup as well.
When deleting orders, the Yireo Delete-Any-Order module does not alter files, so a file backup is not required. We highly recommend making a database backup either by using command-line tools like mysqldump or by using graphical tools like phpMyAdmin.
Using the Delete-Any-Order module
Once you made sure you have a proper backup, you can start using the module by navigating to System > Tools > Delete Any Order. In the overview you can search for a specific order. Once you found an order, you can hit the Delete link. Alternatively you can select one or more orders using the checkboxes on the left, select the Delete option under Actions in the top right and hit Submit.
Before actualling deleting the order(s), the module will display a summary of the order(s) being deleted. If you are sure about deleting the orders, you can the Delete button to actually delete orders. Needless to say you should only do so, if you are absolutely sure and have a backup available.
Analyse the Delete-Any-Order behaviour
To confirm that all entries are really gone from the database, we recommend clicking on the Analyze Database button (in the top right) regularly as well. (In older versions this is a textlink in the button of the page.) This will show per database table any remaining left-overs that should be removed. If left-overs are shown (a higher number than 0), hit the Clean-up button.
If, when deleting an order, left-overs remain (shown on the Analyze Database page) make sure you clean-up afterwards. Also, let us know through a forum post, because the desired result of using Delete-Any-Order should that be that are no left-overs.
Extra configuration options
Within the Magento configuration, you can find some extra options for Delete-Any-Order. These can be found by navigating to System > Configuration > Sales > Delete Any Order. The following options currently exist:
- Reset Stock: If you want Delete-Any-Order to increase the stock number of each product within the order (when that order is deleted), you can enable this option.
Restoring the database
When restoring the database, it is much too complicated to only restore those tables involved with the order-process. We recommend restoring the entire database. If you want to restore the database tables individually, you will need to deal with all tables starting with eav_ and all tables starting with sales (note that there both flat tables as EAV-entities involved here).
When you decide to remove all tables, so you can safely import the database dump (exported earlier), take note that the removal of all tables might result in several iterations. Due to the usage of the InnoDB storage engine, some tables depend on other tables which may lead to those tables still existing after deleting all tables. To bypass this dependency problem, dropping the entire database and restoring it again is the best alternative. Make sure your database ends up with the same permissions (privileges) as before.