Jump to content

Send Welcome e-mail after manual customer account creation


vapersNI

Recommended Posts

Hi folks.

 

How do we send the default welcome email showing e-mail address, password etc to a customer who's account we manually created from our backoffice?

 

From within Preferences - Customers the "Send an e-mail after registration" is set to yes but I think that only applies to accounts created by the customer not accounts we manually create.

 

Any help with this would be greatly appreciated.

 

Prestashop version 1.6.1.4

Edited by vapersNI (see edit history)
Link to comment
Share on other sites

You may have to modify the code to implement this requirements.

 

You need to modify following file

/controllers/admin/AdminCustomers.php

 

Or (recommended)

/override/controllers/admin/AdminCustomers.php

 
You can copy some code from following file for sending email
/controllers/front/AuthController.php
    protected function sendConfirmationMail(Customer $customer)
    {
        if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL')) {
            return true;
        }


        return Mail::Send(
            $this->context->language->id,
            'account',
            Mail::l('Welcome!'),
            array(
                '{firstname}' => $customer->firstname,
                '{lastname}' => $customer->lastname,
                '{email}' => $customer->email,
                '{passwd}' => Tools::getValue('passwd')),
            $customer->email,
            $customer->firstname.' '.$customer->lastname
        );
    }



Link to comment
Share on other sites

 

You may have to modify the code to implement this requirements.

 

You need to modify following file

/controllers/admin/AdminCustomers.php

 

Or (recommended)

/override/controllers/admin/AdminCustomers.php

 
You can copy some code from following file for sending email
/controllers/front/AuthController.php
    protected function sendConfirmationMail(Customer $customer)
    {
        if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL')) {
            return true;
        }


        return Mail::Send(
            $this->context->language->id,
            'account',
            Mail::l('Welcome!'),
            array(
                '{firstname}' => $customer->firstname,
                '{lastname}' => $customer->lastname,
                '{email}' => $customer->email,
                '{passwd}' => Tools::getValue('passwd')),
            $customer->email,
            $customer->firstname.' '.$customer->lastname
        );
    }



 

Hi and thanks for your help.

 

I tried to do as you said but in my /override/controllers/admin/ folder I don't have a file called AdminCustomers.php All I have is a folder names templates, a file called index.php and something else called php.ini

 

In my normal /controllers/admin/ folder I have the following:

AdminCustomersController.php

AdminCustomerPreferencesController.php

AdminCustomerThreadsController.php

 

Am I doing something wrong?

Link to comment
Share on other sites

OK I copied that text you said from the /controllers/front/AuthController.php and pasted into the bottom line in /controllers/admin/AdminCustomersController.php, saved, uploaded etc.

 

But now in my back office when I select Customers I get a page error, page could not be loaded. It returns to normal when I delete the text from the AdminCustomersController.php file

 

I'm probably doing something really stupid which is why it won't work. Any pointers where I'm going wrong?

Link to comment
Share on other sites

It seems that you do not have any PHP coding experience or skill. 

 

You can not do in that way, it will of course cause syntax error. Please try to undo what you have done.

The code must be added before last "}" at end of the file.

 

And copy that code only will not do anything, you also have to add a piece of code where the customer account is created

and then call this function.

 

    public function postProcess()
    {
        if (!$this->can_add_customer && $this->display == 'add') {
            $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers');
        }
 
        parent::postProcess();
 
        $this->sendConfirmationMail($this->object);
    }
 

 

The above code is not tested, you have to test and make if work by yourself.

 

I guess it is better that you hire someone the knows PHP coding and has programming skills to implement that based on my guidance.

Link to comment
Share on other sites

It seems that you do not have any PHP coding experience or skill. 

 

You can not do in that way, it will of course cause syntax error. Please try to undo what you have done.

The code must be added before last "}" at end of the file.

 

And copy that code only will not do anything, you also have to add a piece of code where the customer account is created

and then call this function.

 

    public function postProcess()
    {
        if (!$this->can_add_customer && $this->display == 'add') {
            $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers');
        }
 
        parent::postProcess();
 
        $this->sendConfirmationMail($this->object);
    }
 

 

The above code is not tested, you have to test and make if work by yourself.

 

I guess it is better that you hire someone the knows PHP coding and has programming skills to implement that based on my guidance.

 

It seems that you do not have any PHP coding experience or skill. 

 

You can not do in that way, it will of course cause syntax error. Please try to undo what you have done.

The code must be added before last "}" at end of the file.

 

And copy that code only will not do anything, you also have to add a piece of code where the customer account is created

and then call this function.

 

    public function postProcess()
    {
        if (!$this->can_add_customer && $this->display == 'add') {
            $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers');
        }
 
        parent::postProcess();
 
        $this->sendConfirmationMail($this->object);
    }
 

 

The above code is not tested, you have to test and make if work by yourself.

 

I guess it is better that you hire someone the knows PHP coding and has programming skills to implement that based on my guidance.

You're right, I have absolutely no experience at this sort of thing at all.

 

I have undone what I did and I can now access customers page from prestashop backoffice.

 

Yes I think for these tasks I would need someone who knows exactly what they're doing. I didn't think it would be too difficult but your last message has left me completely baffled.

 

It's rather annoying that a simple feature can't just work on the same basis as when a customer creates their own account.

Link to comment
Share on other sites

It's rather annoying that a simple feature can't just work on the same basis as when a customer creates their own account.

 

 

 

I think this is kind of design issue. it maybe inconvenience for some store owners.

but for most store owner it should be fine, because it will be rare to create customers at back office. Even it is the case, it might be via phone so admin can just tell the customer. or send am simple email.

 

but you are right, this a a good feature to add.

 

 

  • Like 1
Link to comment
Share on other sites

 

 
 

have you tried my previous post #7, does it work?

 

I don't know what I actually need to do :(

 

I've no experience of doing anything like this so I'd either need a visual step by step guide detailing exactly what I need to do or to get someone experienced in Prestashop to do it for me.

Edited by vapersNI (see edit history)
Link to comment
Share on other sites

We manually create accounts frequently after taking telephone orders. I searched for a solution but did not find one

 

So, we create the  account on the shop front so the customer gets the welcome emails immediately. We then switch to back office to create the actual order

Link to comment
Share on other sites

So, we create the  account on the shop front so the customer gets the welcome emails immediately. We then switch to back office to create the actual order

 

 
Actually this is a good idea - a good work around. thanks for sharing.
Link to comment
Share on other sites

We manually create accounts frequently after taking telephone orders. I searched for a solution but did not find one

 

So, we create the  account on the shop front so the customer gets the welcome emails immediately. We then switch to back office to create the actual order

Superb, never even thought of that! Thanks.

 

*shokinro* - I followed your instructions as per post 7 and I couldn't make it work. Lost access to "Customers" in back office until I deleted the text I added from the php file. Its obviously me doing something wrong and I appreciate your help you've offered. 

I'll work it by creating the account in front office myself to trigger the e-mail getting sent.

 

Anyone any suggestions why new voucher codes I create for a specific customer isn't getting e-mailed directly to them using the voucher_new e-mail template?

Edited by vapersNI (see edit history)
Link to comment
Share on other sites

  • 5 months later...
  • 4 years later...
  • 2 months later...

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