Jump to content

[solved] Approve new customers with admin email notification at registration


herba
 Share

Recommended Posts

There is no built-in solutions but several paid modules could be found for this task.

The simplest solution without buying paid add-ons is to add this code to the override/classes/Customer.php

 

class Customer extends CustomerCore
{
    public function add($autodate = true, $null_values = true)
{
		    $this->active = false;
		    return parent::add($autodate, $null_values);
    }
}

 

Then each new customer will appear at the backend as non-active customer and you will need to activate each of them manually and you still will be notified about new customers.

Share this post


Link to post
Share on other sites

I have already so my prospects can't see the prices, so they must apply to be able to see prices, but what we need is i.g an email so we don't have to check every hour or minute, because when people apply they like to buy

Share this post


Link to post
Share on other sites

I have already so my prospects can't see the prices, so they must apply to be able to see prices, but what we need is i.g an email so we don't have to check every hour or minute, because when people apply they like to buy

 

you would need to develop this code as it does not exist in native prestashop.

Share this post


Link to post
Share on other sites

so you mean with this code I get notified via email so I know if someone applied

 

No I meant standard backend notification, for e-mail notification you should use paid solutions or free solution presented above. My piece of code makes users inactive after registration - they should be approved manually to become active.

Share this post


Link to post
Share on other sites

  • 2 months later...

There is no built-in solutions but several paid modules could be found for this task.

The simplest solution without buying paid add-ons is to add this code to the override/classes/Customer.php

 

class Customer extends CustomerCore
{
	    public function add($autodate = true, $null_values = true)
{
			    $this->active = false;
			    return parent::add($autodate, $null_values);
	    }
}
Then each new customer will appear at the backend as non-active customer and you will need to activate each of them manually and you still will be notified about new customers.

 

 

Is this solution for an older Prestashop version? I just tried this solution on a 1.5.6.0 and it did not work. I couldn't find "customer.php" so I created it and uploaded it to the classes folder.  Can you confirm (please). Do I need to reconstruct as a folder (called customer) with this code as it's index file?

Share this post


Link to post
Share on other sites

it's an override, in 1.5.6 this function looks like:

	public function add($autodate = true, $null_values = true)
	{
		$this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->id;
		$this->id_shop_group = ($this->id_shop_group) ? $this->id_shop_group : Context::getContext()->shop->id_shop_group;
		$this->id_lang = ($this->id_lang) ? $this->id_lang : Context::getContext()->language->id;
		$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
		$this->secure_key = md5(uniqid(rand(), true));
		$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));
		
		if ($this->newsletter && !Validate::isDate($this->newsletter_date_add))
			$this->newsletter_date_add = date('Y-m-d H:i:s');
			
		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');

		/* Can't create a guest customer, if this feature is disabled */
		if ($this->is_guest && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))
			return false;
	 	$success = parent::add($autodate, $null_values);
		$this->updateGroup($this->groupBox);
		return $success;
	}

Share this post


Link to post
Share on other sites

 

it's an override, in 1.5.6 this function looks like:

	public function add($autodate = true, $null_values = true)
	{
		$this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->id;
		$this->id_shop_group = ($this->id_shop_group) ? $this->id_shop_group : Context::getContext()->shop->id_shop_group;
		$this->id_lang = ($this->id_lang) ? $this->id_lang : Context::getContext()->language->id;
		$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);
		$this->secure_key = md5(uniqid(rand(), true));
		$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));
		
		if ($this->newsletter && !Validate::isDate($this->newsletter_date_add))
			$this->newsletter_date_add = date('Y-m-d H:i:s');
			
		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');

		/* Can't create a guest customer, if this feature is disabled */
		if ($this->is_guest && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))
			return false;
	 	$success = parent::add($autodate, $null_values);
		$this->updateGroup($this->groupBox);
		return $success;
	}

What file do I add that function to? (sorry I'm a newbie)

Share this post


Link to post
Share on other sites

  • 11 months later...
  • 1 month later...
  • 2 years later...


public function add($autodate = true, $null_values = true)

{

$this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->id;

$this->id_shop_group = ($this->id_shop_group) ? $this->id_shop_group : Context::getContext()->shop->id_shop_group;

$this->id_lang = ($this->id_lang) ? $this->id_lang : Context::getContext()->language->id;

$this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days);

$this->secure_key = md5(uniqid(rand(), true));

$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));

 

/* ADD THIS BELLOW 2 LINES CODE TO DISABLE AUTO ACTIVATION AFTER REGISTRATION*/

$this->active = false;

return parent::add($autodate, $null_values);

 

if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) {

$this->newsletter_date_add = date('Y-m-d H:i:s');

}

 

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');

}

}

 

/* Can't create a guest customer, if this feature is disabled */

if ($this->is_guest && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {

return false;

}

$success = parent::add($autodate, $null_values);

$this->updateGroup($this->groupBox);

return $success;

}

Share this post


Link to post
Share on other sites

  • 4 weeks later...
  • 5 weeks later...

Hey !
 
Please what is the path to the file where to add this piece of code :
 

$this->active = false;
        return parent::add($autodate, $null_values);

 
Thanks !

Share this post


Link to post
Share on other sites

  • 7 months later...
  • 5 months later...
  • 1 year later...
On 5/17/2018 at 8:09 PM, spiralciric said:

Can anyone post a solution for the newest Presta, 1.7? This is really really annoying not to have that feature.

Thanks

Hi,

We have released a module that allows you to manually approve new user registrations. The admin gets an email notification when new user registers.

Here is the link - https://addons.prestashop.com/en/social-login-connect/43591-approve-new-user-registrations.html

 

Share this post


Link to post
Share on other sites

  • 3 months later...
  • 1 year later...
On 10/3/2019 at 8:38 PM, Addify said:

Hi,

We have released a module that allows you to manually approve new user registrations. The admin gets an email notification when new user registers.

Here is the link - https://addons.prestashop.com/en/social-login-connect/43591-approve-new-user-registrations.html

 

Hi,

 

Currently my customers register and we activate them on our website manually. I still want to be able to do this but is there any way of sending them a preset / default email once they have registered? I.e they hit register then receive an email asking for more information.

At the moment we have to email customers 1-by-1 which is time consuming if it could be done as an auto email upon registration.

TIA

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More