Jump to content

How to add a customer automatically on a group based on the address details


Recommended Posts

Hello everyone, I'm looking a way to make my life easier when a new user registered on my website. I want when a new user is creating an account on my website the system will automatically add him on the proper group. Now the new customer is waiting my approve in order to use the website. I'made this because i have to check his address and add him in the appropriate group. This process now i want to make it to be automatically. For example if the customer contains the keyword "king" in his address then add him on the Group A and if his address contains the word "queen" add him on the Group B.

 

Does anyone know how i can do it?

 

Thank you

Link to comment
Share on other sites

yes but this is not of what i'm looking. I was thinking to have an array containing the words that i'm looking for the group A and another array with the words of Group b. Then read the address and if contains the any word from the list of A add it to the group A else check for words of the Group B. 

Where i can find the fields of the address before prestashop stores it to the database

Link to comment
Share on other sites

you can achieve it with regular expression in controller mentioned above.

http://www.kirupa.com/forum/showthread.php?230003-PHP-Extract-domain-without-subdomains-from-email-address

Thanks but the regular expression is not what i'm looking. the solution of webdev0008 is more like what i'm looking. i can use the following if statement to determine which is the group of the user

if (strpos($address,'queen') !== false) {

//att to the A group

}

Edited by giwrgos (see edit history)
Link to comment
Share on other sites

  • 2 years later...
×
×
  • Create New...