Top

The Blog


  1. 6
    Oct
    2009

    How to Delete Test Orders and Reset Counters in Magento

    You’d have thought there was a basic provision for this in Magento, but unfortunately this is not the case and, looking at this thread on the Magento forums, it’s not something that Varien are looking at correcting at any point in the near future. The problem is that in-development stores need testing; to do that properly, you need to push test orders fully through the system, from invoice to completion.

    So what happens when you want to launch the site and you’re stuck with dozens of undesirable test orders? Well, read on to find out how…

    The first thing you need to bear in mind is that, whilst this is possible using a load of MySQL queries, that kind of thing on a working site is pretty scary and risky if you’re not sure what you’re doing. For this reason, I would recommend purchasing the Yireo extension Delete Any Order which will do the job for you. It will also scan the database for orphaned sales data and remove, something which would take significant time by hand.

    The extension costs a mere EUR20 and is worth it just for the piece of mind. Whatever you choose, please ensure you backup your database first.

    Deleting the Orders

    Once you’ve purchased the extension, upload it to the root of your Magento site.

    This will give you an additional option in System->Tools called “Delete Any Order”. Select it to run the extension.

    If you are preparing a store for launch and want to remove all orders and reset the sales reference numbers, select all orders and choose the “Delete” option from the drop-down menu (top-right).

    Reset the Counters

    You don’t really want your new store starting orders, invoices, shipment and credit memos from some random number do you? Do the following to reset these counters to the default (1000001).

    1. Use PHPMyAdmin to view your database.
    2. Click the “SQL” tab.
    3. Paste the following query into the code entry window:

    TRUNCATE `eav_entity_store`;
    ALTER TABLE `eav_entity_store` AUTO_INCREMENT=1;
    SET FOREIGN_KEY_CHECKS=1;

    4. If all goes well, the system will display a message stating that the query was a success.

    The next order placed will now use the default number to start.

    I recommend testing these steps out on a test site rather than your live environment, if that’s possible – just so that you are comfortable with the steps before deploying on a live site.


  2. 0
    Comments

    Something to say? Leave a reply!

    There are no comments on this post yet.

    [TrackBack URL]

    Leave a comment