Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    May 2016
    Location
    Ohio
    Posts
    343
    Plugin Contributions
    0

    Default zen cart delete customer by last login 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?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,025
    Plugin Contributions
    17

    Default Re: zen cart delete customer by last login 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...

  3. #3
    Join Date
    May 2016
    Location
    Ohio
    Posts
    343
    Plugin Contributions
    0

    Default Re: zen cart delete customer by last login date

    That sounds beyond my abilities... what could I use to delete them from the customer list?

  4. #4
    Join Date
    May 2016
    Location
    Ohio
    Posts
    343
    Plugin Contributions
    0

    Default Re: zen cart delete customer by last login date

    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...

  5. #5
    Join Date
    Jul 2012
    Posts
    16,025
    Plugin Contributions
    17

    Default Re: zen cart delete customer by last login date

    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:

    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]);"
    Back up the database before executing the above or any other similar query.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    May 2016
    Location
    Ohio
    Posts
    343
    Plugin Contributions
    0

    Default Re: zen cart delete customer by last login date

    The delete spam customers didn't, I had tried that already, but thanks.

  7. #7
    Join Date
    May 2016
    Location
    Ohio
    Posts
    343
    Plugin Contributions
    0

    Default Re: zen cart delete customer by last login date

    The code you gave me returned this error:

    Query incomplete: missing closing semicolon.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,025
    Plugin Contributions
    17

    Default Re: zen cart delete customer by last login date

    Quote Originally Posted by mc12345678 View Post
    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:

    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]);"
    Back up the database before executing the above or any other similar query.
    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...

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,970
    Plugin Contributions
    109

    Default Re: zen cart delete customer by last login date

    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.

  10. #10
    Join Date
    May 2016
    Location
    Ohio
    Posts
    343
    Plugin Contributions
    0

    Default Re: zen cart delete customer by last login date

    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);

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Curious: Customer Account Create, but Last Login Blank
    By chadderuski in forum General Questions
    Replies: 4
    Last Post: 17 Feb 2013, 04:50 PM
  2. Delete customer carts older than date X (SQL help?)
    By bodyjewelrystores in forum General Questions
    Replies: 10
    Last Post: 1 Mar 2010, 03:36 PM
  3. Replies: 7
    Last Post: 25 Jan 2009, 06:00 AM
  4. Admin-Customer Last Login ip address lookup?
    By Justwade in forum General Questions
    Replies: 2
    Last Post: 20 Dec 2006, 08:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR