If you have an instance (copy) of your shop in test environment and want to crypt all personal data of your customers without losing orders and shop statistics – keep reading.
I’ve listed a few reasons why this task is useful:
– If any data leak would occur, you can be safe because personal data will be encrypted
– 3rd party users (like developers or testers) won’t gain access to sensitive data
– GDPR. Your test environment will most likely be closed for users. That’s why they are losing permission “to be forgotten” and to remove all their data.
Copy and paste following queries in your phpMyAdmin:
UPDATE `ps_address` SET lastname=MD5(CONCAT(RAND(), lastname)), firstname=MD5(CONCAT(RAND(), firstname)), address1=MD5(CONCAT(RAND(), address1)), address2="", postcode="99-999", city="XXXXXX", other="", phone="000000000", phone_mobile=NULL, vat_number=NULL, dni=NULL, company=NULL ; UPDATE `ps_connections` SET ip_address=NULL ; UPDATE `ps_customer` SET lastname=MD5(CONCAT(RAND(), lastname)), firstname=MD5(CONCAT(RAND(), firstname)), siret=NULL, ape=NULL, company=NULL, phone_mobile=NULL, email=MD5(CONCAT(RAND(), email)), passwd=MD5(CONCAT(RAND(), passwd)), birthday=NULL, newsletter=0, regulation=0, optin=0, website=NULL, ip_registration_newsletter=NULL, secure_key=MD5(CONCAT(RAND(), secure_key)), active=0, newsletter_date_add=NULL ; UPDATE `ps_customer_message` SET message=MD5(CONCAT(RAND(), message)), ip_address="", user_agent="" ; UPDATE `ps_customer_thread` SET email=MD5(CONCAT(RAND(), email)) ; UPDATE `ps_message` SET message=MD5(CONCAT(RAND(), message)) ; UPDATE `ps_mail` SET recipient=MD5(CONCAT(RAND(), recipient)) ; UPDATE `ps_newsletter` SET email=MD5(CONCAT(RAND(), email)) ;
If you are using Block reviews
module:
UPDATE `ps_blockreviews` SET subject=MD5(CONCAT(RAND(), subject)), text_review=MD5(CONCAT(RAND(), text_review)), response=MD5(CONCAT(RAND(), response)), customer_name=MD5(CONCAT(RAND(), customer_name)), email=MD5(CONCAT(RAND(), email)), ip=NULL ;
If you are using Product comments
module:
UPDATE `ps_product_comment` SET title=NULL, content=MD5(CONCAT(RAND(), content)), customer_name=NULL ;
As I wrote earlier, make sure there are no additional tables with customers data.
Thanks for reading.