EvilDragon Posted February 1, 2016 Share Posted February 1, 2016 My shop has grown over the years, but after 11 years, there also are quite a few customers with abandoned email addresses. Whenever I send out a newsletter, I get 300 emails back telling me that the email address doesn't exist anymore. Exporting the emails addresses of these users into a list or CSV isn't really an issue. But I'm looking for a way to remove these customer accounts or newsletter subscriptions from PrestaShop. Is there any module that can do this? Remove them using a simple list? Or maybe just some small PHP script I can run (based on the remove customer script from the docs) which reads out a file with one email address per line and then removes the customer? I'm fine running that directly on my servers' bash, so if anyone could help me here, it would be great Link to comment Share on other sites More sharing options...
premiumpresta Posted February 1, 2016 Share Posted February 1, 2016 You can write a simple php script. First read your csv file into an array: $email_array = array_map('str_getcsv', file('invalid_customers.csv')); Then iterate through the $email_array and for each email get the customer id: $customer_id = Customer::customerExists($email, true); With the id load the customer and delete it: if($customer_id) { $customer = new Customer($customer_id); $customer->delete(); } 1 Link to comment Share on other sites More sharing options...
EvilDragon Posted February 13, 2016 Author Share Posted February 13, 2016 Thanks, worked like a charm 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