vapersNI Posted June 21, 2016 Share Posted June 21, 2016 (edited) 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 June 21, 2016 by vapersNI (see edit history) Link to comment Share on other sites More sharing options...
shokinro Posted June 22, 2016 Share Posted June 22, 2016 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 More sharing options...
vapersNI Posted June 22, 2016 Author Share Posted June 22, 2016 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 More sharing options...
shokinro Posted June 22, 2016 Share Posted June 22, 2016 Sorry, it is my mistake, the controllers name for admin page is as following /controllers/admin/AdminCustomersController.php or /override/controllers/admin/AdminCustomersController.php Link to comment Share on other sites More sharing options...
vapersNI Posted June 22, 2016 Author Share Posted June 22, 2016 Thanks. Do I just copy and paste all that text into the bottom of that file? Link to comment Share on other sites More sharing options...
vapersNI Posted June 22, 2016 Author Share Posted June 22, 2016 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 More sharing options...
shokinro Posted June 22, 2016 Share Posted June 22, 2016 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 More sharing options...
vapersNI Posted June 22, 2016 Author Share Posted June 22, 2016 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 More sharing options...
shokinro Posted June 22, 2016 Share Posted June 22, 2016 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. 1 Link to comment Share on other sites More sharing options...
vapersNI Posted June 22, 2016 Author Share Posted June 22, 2016 Yes I don't think we'll be manually adding many accounts but it would be a nice feature to have. Listen thanks very much for your help. I'm sorry I was too stupid to work it out Link to comment Share on other sites More sharing options...
shokinro Posted June 23, 2016 Share Posted June 23, 2016 Listen thanks very much for your help. I'm sorry I was too stupid to work it out have you tried my previous post #7, does it work? Link to comment Share on other sites More sharing options...
vapersNI Posted June 26, 2016 Author Share Posted June 26, 2016 (edited) 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 June 26, 2016 by vapersNI (see edit history) Link to comment Share on other sites More sharing options...
shokinro Posted June 26, 2016 Share Posted June 26, 2016 I think I showed you clearly on how and where to add the code. you only need to test if that works or not. Link to comment Share on other sites More sharing options...
Guest Posted June 26, 2016 Share Posted June 26, 2016 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 More sharing options...
shokinro Posted June 26, 2016 Share Posted June 26, 2016 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 More sharing options...
vapersNI Posted June 26, 2016 Author Share Posted June 26, 2016 (edited) 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 June 26, 2016 by vapersNI (see edit history) Link to comment Share on other sites More sharing options...
ENS Enterprises Posted December 22, 2016 Share Posted December 22, 2016 Actually this code is giving "Fejl: Parameter "to" er i uorden" Link to comment Share on other sites More sharing options...
ENS Enterprises Posted December 22, 2016 Share Posted December 22, 2016 I solved the issue by adding if ($this->object instanceof Customer){ $this->sendConfirmationMail($this->object); } Thanks for the help.. 2 Link to comment Share on other sites More sharing options...
pierrepli Posted April 16, 2021 Share Posted April 16, 2021 Any idea how to do it with Prestashop 1.7.7 ? Link to comment Share on other sites More sharing options...
mr_zo Posted June 25, 2021 Share Posted June 25, 2021 Hello +1 how to do it with Prestashop 1.7. Thanks Link to comment Share on other sites More sharing options...
pierrepli Posted June 26, 2021 Share Posted June 26, 2021 16 hours ago, mr_zo said: Hello +1 how to do it with Prestashop 1.7. Thanks I found a module that works fine for this: https://mypresta.eu/modules/administration-tools/notification-about-new-customer-account.html 1 Link to comment Share on other sites More sharing options...
mr_zo Posted June 26, 2021 Share Posted June 26, 2021 6 hours ago, pierrepli said: I found a module that works fine for this: https://mypresta.eu/modules/administration-tools/notification-about-new-customer-account.html Thank you for your quick reply.🙏 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now