Jump to content

Send Mail When And Admin Creates A New Customer.


razorranjan7753

Recommended Posts

hello all,

 

I want to disable the signup feature in the frontstore of prestashop.

Also i would like to send an email to the email id that the admin uses to create a new account from the admin's customer->add new customer feature.

 

i overrided the controller and modified the function like this to send mail at the last elseif

public function processAdd()
    {
        if (Tools::getValue('submitFormAjax')) {
            $this->redirect_after = false;
        }
        // Check that the new email is not already in use
        $customer_email = strval(Tools::getValue('email'));
        $customer = new Customer();
        if (Validate::isEmail($customer_email)) {
            $customer->getByEmail($customer_email);
        }
        if ($customer->id) {
            $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
            $this->display = 'edit';
            return $customer;
        } elseif (trim(Tools::getValue('passwd')) == '') {
            $this->validateRules();
            $this->errors[] = Tools::displayError('Password can not be empty.');
            $this->display = 'edit';
        } elseif ($customer = parent::processAdd()) {
            $this->context->smarty->assign('new_customer', $customer);
            $resu = Mail::Send((int)(Configuration::get('PS_LANG_DEFAULT')), // defaut language id
                'contact', // email template file to be use
                ' New user', // email subject
                array(
                    '{email}' => Configuration::get('PS_SHOP_EMAIL'), // sender email address
                    '{message}' => ' New user registration' // email content
                ),
                "'".$customer->email."'", // receiver email address
                NULL, NULL, NULL);
            error_log(print_r($resu,true));
            return $customer;
        }
        return false;
    }

But the mail is not working....

 

Can anyone let me know the issue in this?

And i have already tested the mail section in other modules like order,testmail etc.

 

PS version: 1.6.1.1

 

Thanks.

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...