Jump to content

Client group assign - PS 1.6


rxdue

Recommended Posts

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 :)

 

  • Like 1
Link to comment
Share on other sites

 

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

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

 

:huh2:

Edited by rxdue (see edit history)
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...