If I have customers who have not logged in since 2018... is there a SQL code I can use to delete all customers who have not logged in after a certain date?
If I have customers who have not logged in since 2018... is there a SQL code I can use to delete all customers who have not logged in after a certain date?
Sure, but how much of their information are you wanting to delete?
It may be best to address the issue through some php code to ensure that all aspects of the customer are addressed in the deletion.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
That sounds beyond my abilities... what could I use to delete them from the customer list?
Zen Cart really needs a simple way to delete customers in bulk... searching for last logins over a year or two or three, no orders, etc...
So there is this plugin that has been written: Delete Spam Customers - Zen Cart Plugins (zen-cart.com) it may accomplish a lot of what is desired at least based on its description.
I'm sure that a Pull Request would be welcomed if there is something put together to support what is described.
Otherwise, a delete query for just the customer's list would be something like:
Back up the database before executing the above or any other similar query.Code:DELETE FROM customers WHERE customers_id IN (SELECT customers_info_id FROM customers_info WHERE customers_info_date_of_last_logon < [COLOR=var(--highlight-color)]DATE_SUB(NOW(),INTERVAL 3 YEAR)[/COLOR]);"
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
The delete spam customers didn't, I had tried that already, but thanks.
The code you gave me returned this error:
Query incomplete: missing closing semicolon.
That wasn't supposed to have a lot of the extra characters, but that's what happens these days in Microsoft Edge when pasting content. Should have been:
Code:DELETE FROM customers WHERE customers_id IN (SELECT customers_info_id FROM customers_info WHERE customers_info_date_of_last_logon < DATE_SUB(NOW(),INTERVAL 3 YEAR));
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Delete spam customers can do this kind of thing, you just have to tweak the query.
DON'T DO THIS:
DELETE FROM customers WHERE ...
this will make your customers and customers_info tables out of sync. Delete Spam Customers cleans out ALL the tables properly.
That Software Guy. My Store: Zen Cart Modifications
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Okay, so once I install the addon what query would I use to delete all customers who have not logged in within the past 2 years?
The SQL included with the addon is:
INSERT INTO admin_pages (page_key, language_key, main_page, page_params, menu_key, display_on_menu, sort_order) VALUES ('deleteSpamCustomers', 'BOX_CUSTOMERS_DELETE_SPAM_CUSTOMERS', 'FILENAME_DELETE_SPAM_CUSTOMERS', '', 'customers', 'Y', 999);
Bookmarks