Jump to content

Default customer group after registration


Recommended Posts

Hi,

 

I'm using ps 1.5.6.2.

 

May i know how to automatically assign register customer to another new customer group?

 

I have read this related topics but unable to implement.

 

have four customer group

 

id       :  Group
1        : Visitor

2        ;  Guest

3        : Customer

4        ; NonCustomer

 

In my situation i want every successful registration will goes to group id 4 which is NonCustomer group.

 

Please guide me, very thanks :-)

Link to comment
Share on other sites

I am not sure it can be done from the back office. However, for sure you have a configuration entry in the database named PS_CUSTOMER_GROUP, you can change that to 4, it should set it as default customer group

 

using that way, i have to manually change the value in phpmyadmin/mysql to 4. 

 

I'm sure it can be done by editing some file/php. by my skill is limited to do that.

 

Hope someone can help me

Link to comment
Share on other sites

classes/Customer.php

	public function __construct($id = null)
	{
		$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
		parent::__construct($id);
	}

default customer group is defined in (int)Configuration::get('PS_CUSTOMER_GROUP'); code

it's a part of ps_configuration table.

 

so you can do it in two ways,

change customer.php class, instead of (int)Configuration::get('PS_CUSTOMER_GROUP'); use other customer group

 

or just alter PS_CUSTOMER_GROUP in database 

Link to comment
Share on other sites

classes/Customer.php

	public function __construct($id = null)
	{
		$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
		parent::__construct($id);
	}

default customer group is defined in (int)Configuration::get('PS_CUSTOMER_GROUP'); code

it's a part of ps_configuration table.

 

so you can do it in two ways,

change customer.php class, instead of (int)Configuration::get('PS_CUSTOMER_GROUP'); use other customer group

 

or just alter PS_CUSTOMER_GROUP in database 

 

thanks.

 

for 2nd choice which is to alter PS_CUSTOMER_GROUP in database, i don't think it is reliable with my case.

 

and for the 1st choice, can you give me clearly instruction how to do that, i am not expert in php skills.

 

my classes/customer.php from line 194-205 is like below, and assume the default group id i want is 4. can you give me clear instruction

on this?

protected static $_defaultGroupId = array();
	protected static $_customerHasAddress = array();
	protected static $_customer_groups = array();
	
	public function __construct($id = null)
	{
		$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
		parent::__construct($id);
	}
	
	public function add($autodate = true, $null_values = true)
	{

thanks

Link to comment
Share on other sites

  • 3 weeks later...

Yes i know what vekia said,

 

My case, the default customer group after registration is not the visitor,

 

I dont't know whay but the new member is register by default in the group 3.

 

I try to return the default customer group after registration is the visiter (who is id 1)

Link to comment
Share on other sites

Try changing it to inside the add() method as well

		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');
Link to comment
Share on other sites

  • 2 years later...

 

change this line:

$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');

to

$this->id_default_group = 4;

Thank you very much. This worked for me. but I would also like to change the "Group access" 

With the above change only the "Default customer"r group was updated.

How can do the same with  "Group access" ?

Thank you 

Link to comment
Share on other sites

×
×
  • Create New...