Gaellyne Posted June 16, 2022 Share Posted June 16, 2022 Bonjour, Je cherche un moyen de supprimer d'anciennes commandes suivant un critère défini sur un Prestashop 1.6 (par exemple les commandes datant d'il y a plus de deux ans). J'anticipe les réponses, je sais qu'il est illégal en France de supprimer des commandes, mais ces dernières ont été importées dans un logiciel de gestion commerciale.. Il y a actuellement plusieurs dizaines de milliers de commandes sur le site en question. Si vous avez des solutions (module, requetes ou autres), je suis preneuse Merci d'avance pour vos réponses et bonne journée Link to comment Share on other sites More sharing options...
juanrojas Posted June 16, 2022 Share Posted June 16, 2022 bonjour, avec emagicone vous pouvez selectionner les commandes en masse, pique supprimer et c'est tout Link to comment Share on other sites More sharing options...
PrestaServicePro Posted June 16, 2022 Share Posted June 16, 2022 Bonjour, Consultez ce module gratuit : https://mypresta.eu/modules/administration-tools/delete-orders-free.html Remarque : N'oubliez pas de faire une sauvegarde avant de démarrer le processus. Link to comment Share on other sites More sharing options...
Tom Girou Posted June 16, 2022 Share Posted June 16, 2022 DELETE FROM ps_order_carrier WHERE date_add < '2020-06-16'; DELETE ps_order_detail_tax FROM ps_order_detail_tax LEFT JOIN ps_order_detail ON ps_order_detail.id_order_detail = ps_order_detail_tax.id_order_detail LEFT JOIN ps_orders ON ps_order_detail.id_order = ps_orders.id_order WHERE ps_orders.date_add < '2020-06-16'; DELETE ps_order_detail FROM ps_order_detail LEFT JOIN ps_orders ON ps_order_detail.id_order = ps_orders.id_order WHERE ps_orders.date_add < '2020-06-16'; DELETE FROM ps_order_history WHERE date_add < '2020-06-16'; DELETE ps_order_invoice_payment FROM ps_order_invoice_payment LEFT JOIN ps_order_invoice ON ps_order_invoice.id_order_invoice = ps_order_invoice_payment.id_order_invoice WHERE date_add < '2020-06-16'; DELETE ps_order_invoice_tax FROM ps_order_invoice_tax LEFT JOIN ps_order_invoice ON ps_order_invoice.id_order_invoice = ps_order_invoice_tax.id_order_invoice WHERE date_add < '2020-06-16'; DELETE FROM ps_order_invoice WHERE date_add < '2020-06-16'; DELETE FROM ps_order_payment WHERE date_add < '2020-06-16'; DELETE FROM ps_orders WHERE date_add < '2020-06-16'; Je vous conseille d'utiliser "SELECT *" au lieu de "DELETE x FROM" afin de vérifier ce qui va être supprimé. Vous pouvez modifier la date. J'ai mis 2 ans à partir d'aujourd'hui. Il se peut qu'il y ait d'autres tables à vider, mais j'ai mis les principales. Link to comment Share on other sites More sharing options...
Gaellyne Posted June 16, 2022 Author Share Posted June 16, 2022 Merci pour vos retours, je vais étudier tout ça ! @Tom Girou, je vais essayer les requetes sur une base test, merci beaucoup Link to comment Share on other sites More sharing options...
Gaellyne Posted July 8, 2022 Author Share Posted July 8, 2022 On 6/16/2022 at 11:30 AM, Tom Girou said: DELETE FROM ps_order_carrier WHERE date_add < '2020-06-16'; DELETE ps_order_detail_tax FROM ps_order_detail_tax LEFT JOIN ps_order_detail ON ps_order_detail.id_order_detail = ps_order_detail_tax.id_order_detail LEFT JOIN ps_orders ON ps_order_detail.id_order = ps_orders.id_order WHERE ps_orders.date_add < '2020-06-16'; DELETE ps_order_detail FROM ps_order_detail LEFT JOIN ps_orders ON ps_order_detail.id_order = ps_orders.id_order WHERE ps_orders.date_add < '2020-06-16'; DELETE FROM ps_order_history WHERE date_add < '2020-06-16'; DELETE ps_order_invoice_payment FROM ps_order_invoice_payment LEFT JOIN ps_order_invoice ON ps_order_invoice.id_order_invoice = ps_order_invoice_payment.id_order_invoice WHERE date_add < '2020-06-16'; DELETE ps_order_invoice_tax FROM ps_order_invoice_tax LEFT JOIN ps_order_invoice ON ps_order_invoice.id_order_invoice = ps_order_invoice_tax.id_order_invoice WHERE date_add < '2020-06-16'; DELETE FROM ps_order_invoice WHERE date_add < '2020-06-16'; DELETE FROM ps_order_payment WHERE date_add < '2020-06-16'; DELETE FROM ps_orders WHERE date_add < '2020-06-16'; Je vous conseille d'utiliser "SELECT *" au lieu de "DELETE x FROM" afin de vérifier ce qui va être supprimé. Vous pouvez modifier la date. J'ai mis 2 ans à partir d'aujourd'hui. Il se peut qu'il y ait d'autres tables à vider, mais j'ai mis les principales. Bonjour, J'ai enfin pris le temps d'exécuter les commandes, tout est ok ! Encore merci :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now