FerreireX Posted June 25, 2020 Share Posted June 25, 2020 Hi, How can I delete an customer or bulk of customers when I got the error "Property Customer->lastname is not valid". There is any other way to delete a bulk of fake customers ? Link to comment Share on other sites More sharing options...
Guest Posted June 26, 2020 Share Posted June 26, 2020 How can a bad customer be identified? Link to comment Share on other sites More sharing options...
FerreireX Posted June 27, 2020 Author Share Posted June 27, 2020 a few months agora I have a problem with spam and have created a lot of customers, now I'm trying to clean the spam ones but this error happen all the time. Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2020 Share Posted June 27, 2020 PrestaShop version please. Link to comment Share on other sites More sharing options...
FerreireX Posted June 27, 2020 Author Share Posted June 27, 2020 Thanks for the quick reply version 1.6.1.24 Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2020 Share Posted June 27, 2020 I need to know how to identify spam customers. Can you give a list? An example of why there is an error in lastname! Then I'll give you a sample script on how to remove unwanted customers in bulk and how to handle their registration. Link to comment Share on other sites More sharing options...
FerreireX Posted June 27, 2020 Author Share Posted June 27, 2020 The last name is links Just attach a screenshot of a few fake customers. Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2020 Share Posted June 27, 2020 Ok, lastname is www...... ? Link to comment Share on other sites More sharing options...
FerreireX Posted June 27, 2020 Author Share Posted June 27, 2020 Yes in all of that fake/spam customers Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2020 Share Posted June 27, 2020 moment please Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2020 Share Posted June 27, 2020 (edited) Copy text and save to prestashop root folder. This script removes fake customers and orders when the last name contains www in the name. File name: fake-delete.php <?php require(dirname(__FILE__).'/config/config.inc.php'); $get_fake_customer = Db::getInstance()->executeS("SELECT id_customer FROM "._DB_PREFIX_."customer WHERE lastname LIKE '%www.%'"); $result = ''; foreach ($get_fake_customer as $fake_customer) { $customer = new Customer($fake_customer['id_customer']); if ($customer->delete()) { $result .= 'id customer: '.$fake_customer['id_customer'].' - DELETED'.'<br />'; $get_order = Db::getInstance()->executeS('SELECT id_order FROM '._DB_PREFIX_.'orders WHERE id_customer = '.$fake_customer['id_customer']); if ($get_order) { foreach ($get_order as $orders) { $order = new Order($orders['id_order']); if ($order->delete()) { $result .= 'id order: '.$orders['id_order'].' - DELETED'.'<br />'; } else { $result .= 'id order: '.$orders['id_order'].' - NOT DELETED'.'<br />'; } } } } else { $result .= 'id customer: '.$fake_customer['id_customer'].' - NOT DELETED'.'<br />'; } } echo $result; Edited June 27, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2020 Share Posted June 27, 2020 I'll write the antispam protection script for you tomorrow. Unfortunately, I don't have time today. I am sorry. Just find reCaptcha for register and contact form on the forum. Link to comment Share on other sites More sharing options...
FerreireX Posted June 27, 2020 Author Share Posted June 27, 2020 Thank you so much @Guest works perfect. After this invasion of fake messages and account creation I have installed a reCaptcha and few more security layers. really don't imagine a few lines of code made such a big work on background, you are really good developer. Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2020 Share Posted June 27, 2020 Thank you for your appreciation. I gladly helped. 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