Jump to content
herba

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

Recommended Posts

We like to approve our customers manually, is it a way to get email or ams when they have applied ?

Share this post


Link to post
Share on other sites

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

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

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

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


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

And how to redirect user to cms page because  now customer is created in back not active but is redirected to registration form without info

Share this post


Link to post
Share on other sites

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

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

Thanks

Share this post


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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