Boopathy Posted May 14, 2014 Share Posted May 14, 2014 Hi, I am trying to add users with particular email id are automatically added into the same group. For example users having account in gmail should come under the GMAIL group created by me in prestashop. Is that possible in prestashop or should I have to add the functionality in the source??? Thanks in advance. Link to comment Share on other sites More sharing options...
vekia Posted May 16, 2014 Share Posted May 16, 2014 by default it's not possible, only with modification of core. the question is: you want assign new customers only? (while register) or also customers that already have an account in your shop? Link to comment Share on other sites More sharing options...
Boopathy Posted May 16, 2014 Author Share Posted May 16, 2014 Hi vekia, Okay..! For your question, Yes, I want to assingn to new customers. Cuz i have a plan in my mind to restrict offers to customers in selected groups. Let me get this straight , if i have a deal with a company named xxxx, then the employees in that company who have id in the format [email protected]/+, they all should come under the group xxxx. Thanks. Link to comment Share on other sites More sharing options...
vekia Posted May 16, 2014 Share Posted May 16, 2014 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 More sharing options...
Boopathy Posted May 17, 2014 Author Share Posted May 17, 2014 Thank you! . But its not working though!! I don know where i am missing... I replaced as you said.. but no results.Could you please explain so that i can retry. Link to comment Share on other sites More sharing options...
vekia Posted May 17, 2014 Share Posted May 17, 2014 with what group customer is associated if you create an account with gmail.com ? Link to comment Share on other sites More sharing options...
Boopathy Posted May 17, 2014 Author Share Posted May 17, 2014 It is associated with the default customer group..! Link to comment Share on other sites More sharing options...
Rissinko Posted November 18, 2015 Share Posted November 18, 2015 (edited) Hi Vekia I tried this code on 1.6.1.0 and it doesnt work.. I put to the code id of group like this : '4' and then tried the name of the group but nothing. Maybe I doing something wrong... please help Edited November 18, 2015 by Rissinko (see edit history) Link to comment Share on other sites More sharing options...
Ignasi Fernandez Posted November 24, 2015 Share Posted November 24, 2015 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 Hi Vekia Should this work in 1.6.0.6? I tried and it didn't work. It looks quite simple but it's not working. Link to comment Share on other sites More sharing options...
Recommended Posts