FOL9000

Magento: Alle Bestellungen löschen

von | 66 Kommentare

Auf Testsystemen häufen sich schnell Bestellungen an, die irgendwann stören. Besonders das Übertragen der Datenbank auf andere Systeme ist dann zwar noch möglich, aber man hat den Test-Müll dann auch auf dem neuen System. Weil Magento keine Funktion hat, um Bestellungen zu löschen, hilft das folgende Script: Es versetzt die Datenbank wieder in einen vorzeigbaren und brauchbaren Zustand.

Das kurze SQL-Script löscht den beim Testen anfallenden Bestellungs-Müll. Alles, was beim Testen so anfällt, was man aber nicht auf andere Systeme übertragen möchte, wird komplett entfernt. Danach dürfte die Datenbank in einem sauberen Zustand sein, sodass man ein Datenbank-Export problemlos auf einem anderen System einsetzen kann.

Die Datenbankstruktur von Magento ist nicht gerade einfach und zwischen den Versionen auch manchmal leicht unterschiedlich. Ich habs unter 1.7.0.2 ausprobiert und es funktionierte problemlos. Trotzdem: Anwendung auf eigene Gefahr, und vorher ein Backup machen! (Kleines Update: Auch unter 1.9.0.1 funktioniert es.)

Das Script setzt nicht den Counter für die Bestell-Nummern zurück. Hat man zehn Bestellungen gelöscht bekommt trotz des Löschens die nächste Bestellung die Nummer elf. Dies lässt sich mit Anweisungen zum Setzen des Increment-Counters lösen, die ich ebendort beschrieben habe.

Vor dem Ausführen muss natürlich noch im USE-Statement der richtige Datenbank-Name eingesetzt werden.

Und noch etwas: Obwohl der folgende SQL-Code an Einfachheit kaum zu überbieten sein dürfte: Er ist nicht von mir, ich weiß aber auch nicht mehr, woher er ist.

-- Reset Magento Test Data
-- Checked with 1.7.0.2
USE `magento_databse`;
SET FOREIGN_KEY_CHECKS=0;
-- reset dashboard search queries
TRUNCATE `catalogsearch_query`;
ALTER TABLE `catalogsearch_query` AUTO_INCREMENT=1;
-- reset sales order info
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_payment`;
TRUNCATE `sales_flat_order_status_history`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_quote_payment`;
TRUNCATE `sales_flat_quote_shipping_rate`;
TRUNCATE `sales_flat_shipment`;
TRUNCATE `sales_flat_shipment_comment`;
TRUNCATE `sales_flat_shipment_grid`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_track`;
TRUNCATE `sales_invoiced_aggregated`;
TRUNCATE `sales_invoiced_aggregated_order`;
TRUNCATE `sales_order_aggregated_created`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;
ALTER TABLE `sales_flat_creditmemo` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_status_history` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_shipping_rate` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_track` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_aggregated_created` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;
SET FOREIGN_KEY_CHECKS=1;

66 Kommentare

  1. Article Source a viral game app is not that much

  2. Article Source a viral game app is not that much

  3. Article Source a viral game app is not that much

  4. Pretty portion of content. I just stumbled upon your web site and in accession capital to assert that I acquire actually enjoyed account your blog posts. Any way I will be subscribing in your augment or even I fulfillment you access constantly quickly.

  5. Pretty portion of content. I just stumbled upon your web site and in accession capital to assert that I acquire actually enjoyed account your blog posts. Any way I will be subscribing in your augment or even I fulfillment you access constantly quickly.

  6. Pretty portion of content. I just stumbled upon your web site and in accession capital to assert that I acquire actually enjoyed account your blog posts. Any way I will be subscribing in your augment or even I fulfillment you access constantly quickly.

  7. This design is wicked! You obviously know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog well, almostHaHa! Wonderful job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  8. This design is wicked! You obviously know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog well, almostHaHa! Wonderful job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  9. This design is wicked! You obviously know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog well, almostHaHa! Wonderful job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  10. Great website! I am loving it!! Will be back later to read some more. I am taking your feeds also

  11. Great website! I am loving it!! Will be back later to read some more. I am taking your feeds also

  12. Informative Site Hello guys here are some links that contains information which you might find useful yourselves. It is Worth Checking out.

  13. Informative Site Hello guys here are some links that contains information which you might find useful yourselves. It is Worth Checking out.

  14. You’re so interesting! I don’t think I have read anything like this before. So wonderful to discover somebody with some unique thoughts on this subject matter. Seriously.. thank you for starting this up. This website is one thing that is needed on the internet, someone with a bit of originality!

  15. You’re so interesting! I don’t think I have read anything like this before. So wonderful to discover somebody with some unique thoughts on this subject matter. Seriously.. thank you for starting this up. This website is one thing that is needed on the internet, someone with a bit of originality!

  16. You’re so interesting! I don’t think I have read anything like this before. So wonderful to discover somebody with some unique thoughts on this subject matter. Seriously.. thank you for starting this up. This website is one thing that is needed on the internet, someone with a bit of originality!

  17. As soon as I detected this site I went on reddit to share some of the love with them.

  18. As soon as I detected this site I went on reddit to share some of the love with them.

  19. As soon as I detected this site I went on reddit to share some of the love with them.

  20. I truly appreciate this post. I’ve been looking everywhere for this! Thank goodness I found it on Bing. You’ve made my day! Thank you again!

  21. I truly appreciate this post. I’ve been looking everywhere for this! Thank goodness I found it on Bing. You’ve made my day! Thank you again!

  22. I truly appreciate this post. I’ve been looking everywhere for this! Thank goodness I found it on Bing. You’ve made my day! Thank you again!

  23. I was very pleased to discover this website. I wanted to thank you for your time for this fantastic read!!

  24. I was very pleased to discover this website. I wanted to thank you for your time for this fantastic read!!

  25. I was very pleased to discover this website. I wanted to thank you for your time for this fantastic read!!

  26. hi! , Everyone loves a persons writing quite definitely! promote many of us keep up a correspondence more info on your own document for Yahoo? I need a pro for this dwelling to unravel this dilemma. Could be that is definitely a person! Looking forward to search an individual.

  27. hi! , Everyone loves a persons writing quite definitely! promote many of us keep up a correspondence more info on your own document for Yahoo? I need a pro for this dwelling to unravel this dilemma. Could be that is definitely a person! Looking forward to search an individual.

  28. hi! , Everyone loves a persons writing quite definitely! promote many of us keep up a correspondence more info on your own document for Yahoo? I need a pro for this dwelling to unravel this dilemma. Could be that is definitely a person! Looking forward to search an individual.

  29. Amazing YouTube movies posted at this website, I am going to subscribe for daily updates, as I dont want to fail to take this series.

  30. Amazing YouTube movies posted at this website, I am going to subscribe for daily updates, as I dont want to fail to take this series.

  31. Amazing YouTube movies posted at this website, I am going to subscribe for daily updates, as I dont want to fail to take this series.

  32. whoah this blog is fantastic i really like studying your articles. Keep up the good paintings! You understand, many individuals are looking around for this info, you could aid them greatly.

  33. whoah this blog is fantastic i really like studying your articles. Keep up the good paintings! You understand, many individuals are looking around for this info, you could aid them greatly.

  34. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

  35. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

  36. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

  37. Whats Taking place i am new to this, I stumbled upon this I have found It positively helpful and it has aided me out loads. I hope to contribute &amp assist other users like its helped me. Great job.

  38. Whats Taking place i am new to this, I stumbled upon this I have found It positively helpful and it has aided me out loads. I hope to contribute &amp assist other users like its helped me. Great job.

  39. Whats Taking place i am new to this, I stumbled upon this I have found It positively helpful and it has aided me out loads. I hope to contribute &amp assist other users like its helped me. Great job.

  40. Totally pent subject matter, appreciate it for selective information.

  41. Totally pent subject matter, appreciate it for selective information.

  42. Totally pent subject matter, appreciate it for selective information.

  43. This web site really has all the information and facts I wanted about this subject and didn’t know who to ask.

  44. This web site really has all the information and facts I wanted about this subject and didn’t know who to ask.

  45. This web site really has all the information and facts I wanted about this subject and didn’t know who to ask.

  46. Magnificent site. Plenty of useful information here. I’m sending it to some friends ans additionally sharing in delicious. And certainly, thanks in your sweat!

  47. Magnificent site. Plenty of useful information here. I’m sending it to some friends ans additionally sharing in delicious. And certainly, thanks in your sweat!

  48. Magnificent site. Plenty of useful information here. I’m sending it to some friends ans additionally sharing in delicious. And certainly, thanks in your sweat!

  49. I have to agree with your statement with this issue and

  50. I have to agree with your statement with this issue and

  51. Usually I do not read writeup on blogs, nevertheless I wish to say that this writeup extremely forced me to take a look at and do so! Your writing taste has been amazed me. Thanks, really wonderful post.

  52. Usually I do not read writeup on blogs, nevertheless I wish to say that this writeup extremely forced me to take a look at and do so! Your writing taste has been amazed me. Thanks, really wonderful post.

  53. Immigration Lawyers …the time to read or pay a visit to the content or internet sites we have linked to below the…

  54. Immigration Lawyers …the time to read or pay a visit to the content or internet sites we have linked to below the…

  55. Good day! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?

  56. Good day! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?

  57. Very efficiently written post. It will be valuable to anyone who usess it, as well as myself. Keep doing what you are doing i will definitely read more posts.

  58. Very efficiently written post. It will be valuable to anyone who usess it, as well as myself. Keep doing what you are doing i will definitely read more posts.

  59. Really appreciate you sharing this post.Thanks Again. Really Great.

  60. Really appreciate you sharing this post.Thanks Again. Really Great.

  61. Purchase Generic Bactrim 800mg Without Prescription in Arlington

  62. Purchase Generic Bactrim 800mg Without Prescription in Arlington

  63. Purchase Generic Bactrim 800mg Without Prescription in Arlington

  64. Hi, Neat post. There is an issue together with your site in internet explorer, may test this IE nonetheless is the marketplace leader and a huge part of folks will leave out your magnificent writing because of this problem.

  65. Hi, Neat post. There is an issue together with your site in internet explorer, may test this IE nonetheless is the marketplace leader and a huge part of folks will leave out your magnificent writing because of this problem.

  66. Hi, Neat post. There is an issue together with your site in internet explorer, may test this IE nonetheless is the marketplace leader and a huge part of folks will leave out your magnificent writing because of this problem.

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.