rxdue Posted February 27, 2017 Share Posted February 27, 2017 Hi! I need to know where prestashop assign the client group while registration. I think in "Customer.php" but i didn't found that. Can someone help me? Thanks Link to comment Share on other sites More sharing options...
GT ITECH Posted February 27, 2017 Share Posted February 27, 2017 In "controllers/front/AuthController.php" Search for $customer->addGroups functions Link to comment Share on other sites More sharing options...
rxdue Posted February 27, 2017 Author Share Posted February 27, 2017 (edited) Thanks GT ITECH. I need to add just an "if" to choise the default group.. if ($id_gender == 1) { $id_default_group = 3; } else { $id_default_gruop = 4; } But i can't where to place it =\ Edited February 27, 2017 by rxdue (see edit history) Link to comment Share on other sites More sharing options...
GT ITECH Posted February 27, 2017 Share Posted February 27, 2017 On line 622 approx just before the line $this->updateContext($customer); put this code : if ($customer->id_gender == 1) { $customer->cleanGroups(); $customer->addGroups(array(3)); $customer->id_default_group = 3; } else { $customer->cleanGroups(); $customer->addGroups(array(4)); $customer->id_default_group = 4; } It must work 1 Link to comment Share on other sites More sharing options...
rxdue Posted February 27, 2017 Author Share Posted February 27, 2017 On line 622 approx just before the line $this->updateContext($customer); put this code : if ($customer->id_gender == 1) { $customer->cleanGroups(); $customer->addGroups(array(3)); $customer->id_default_group = 3; } else { $customer->cleanGroups(); $customer->addGroups(array(4)); $customer->id_default_group = 4; } It must work Thanks! This work in part. While registration the user gets the group in "Group access" but in the field "Default group" remain the default one.. I was trying to change it in "Customer.php" but i can't =( Link to comment Share on other sites More sharing options...
rxdue Posted February 27, 2017 Author Share Posted February 27, 2017 (edited) Im close but can't fix this. On line 217 of "Customer.php" i've edited this: if ($this->id_default_group == Configuration::get('PS_CUSTOMER_GROUP')) { if ($this->is_guest) { $this->id_default_group = (int)Configuration::get('PS_GUEST_GROUP'); } else { $this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP'); } } with this: if ($this->id_default_group == Configuration::get('PS_CUSTOMER_GROUP')) { if ($this->is_guest) { $this->id_default_group = (int)Configuration::get('PS_GUEST_GROUP'); } else { if ($id_gender == 3) { $this->id_default_group = 3; } else { $this->id_default_group = 4; } } } But this keep assign the 4 even if $id_gender is 4 Edited February 27, 2017 by rxdue (see edit history) Link to comment Share on other sites More sharing options...
rxdue Posted February 28, 2017 Author Share Posted February 28, 2017 any idea? 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