Jump to content

Automatically Add New Customers To Group By Mail Domain


Recommended Posts

the workflow to achieve it will be:
1) extract domain name from customer email

2) check grups if group with selected name exists

3) create new group if doesnt exist

4) assign customer to group

 

it is achievable with module (with account register hook) and also with customization of prestashop core

Link to comment
Share on other sites

Hi Vekia. I know the workflow because first what i tried was this solution from you ... but it doesn't work for me on version 1.6.1.0

There is big chance that something has change from 2014 in this registration process... and I do not know very well the process of registration in PrestaShop so I can't figure it out.

 

 

vekia, on 16 May 2014 - 10:48 PM, said:snapback.png

okay, so in file controllers/front/AuthController.php you can find code like:

$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));

change it to:

list($user, $domain) = explode('@', $_POST['email']);

if ($domain == 'gmail.com') {
$customer->addGroups(array(ID_OF_GMAIL_GROUP));
} elseif ($domain =='hotmail.com' ) {
$customer->addGroups(array(ID_OF_HOTMAIL_GROUP));
} else {
$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
}

if code above is not clear for your, let me know i will explain

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...