HT915 Posted December 31, 2016 Share Posted December 31, 2016 When creating customers from control panel, it is possible to email them the password or a link where they can set it? Link to comment Share on other sites More sharing options...
vekia Posted January 1, 2017 Share Posted January 1, 2017 Hello this feature is not available in prestashop by default. you can achieve this with modifications of AdminCustomersController.php add there function /** * sendConfirmationMail * @param Customer $customer * @return bool */ 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 ); } and modify function processAdd() to: 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); $this->sendConfirmationMail($customer); return $customer; } return false; } (i added sendConfirmationMail() function to last if condition customer will receive the email then, the same as customer received while register during standard register process Link to comment Share on other sites More sharing options...
HT915 Posted January 1, 2017 Author Share Posted January 1, 2017 Thank you Vekia, I tried exactly what you suggested but still no luck. No errors but no email in customer inbox either. My system seems to be properly configured as I receive the test email you send from "advanced parameters". Any other idea? Link to comment Share on other sites More sharing options...
vekia Posted January 2, 2017 Share Posted January 2, 2017 can you please show full code that you modified? Link to comment Share on other sites More sharing options...
HT915 Posted January 2, 2017 Author Share Posted January 2, 2017 can you please show full code that you modified? Of course http://pastebin.com/DzsR3u24 Link to comment Share on other sites More sharing options...
vekia Posted January 2, 2017 Share Posted January 2, 2017 code looks okay, it should send messages properly. please go to adv. parameters > emails you can find there "emails log" with all emails that shop sent. do you see on this list "welcome" email associated with email that you created in shop back office ? code looks okay, it should send messages properly. please go to adv. parameters > emails you can find there "emails log" with all emails that shop sent. do you see on this list "welcome" email associated with email that you created in shop back office ? Link to comment Share on other sites More sharing options...
HT915 Posted January 2, 2017 Author Share Posted January 2, 2017 code looks okay, it should send messages properly. please go to adv. parameters > emails you can find there "emails log" with all emails that shop sent. do you see on this list "welcome" email associated with email that you created in shop back office ? code looks okay, it should send messages properly. please go to adv. parameters > emails you can find there "emails log" with all emails that shop sent. do you see on this list "welcome" email associated with email that you created in shop back office ? I'm afraid there is no list, only an "log emails" button which is set to YES. Link to comment Share on other sites More sharing options...
HT915 Posted January 2, 2017 Author Share Posted January 2, 2017 (edited) $this->sendConfirmationMail($customer) eval to false, I'm digging trying to figure how to add some extra debugging, maybe you can give me some hint about that. Tried with if(!$this->sendConfirmationMail($customer)) { die(); } But there is no output. Edited January 2, 2017 by HT915 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 2, 2017 Share Posted January 2, 2017 I'm afraid there is no list, only an "log emails" button which is set to YES. what is the ps version ? (i need exact number) Link to comment Share on other sites More sharing options...
HT915 Posted January 2, 2017 Author Share Posted January 2, 2017 what is the ps version ? (i need exact number) 1.6.1.10 Link to comment Share on other sites More sharing options...
vekia Posted January 3, 2017 Share Posted January 3, 2017 so we have probably some issue modification that i did was from ps 1.6.1.10 and under adv. parameters > email you should have a list of emails: Link to comment Share on other sites More sharing options...
HT915 Posted January 3, 2017 Author Share Posted January 3, 2017 Alright found something in the logs Error - La siguiente plantilla de correo no se encuentra: /var/www/html/shop/mails/es/account.txt which translates in "The following email template was not found", or something. I noticed /var/www/html/shop/mails/en/ has a lot of files but there is only lang.php at /var/www/html/shop/mails/es/ Is there a module or package I am missing? Link to comment Share on other sites More sharing options...
HT915 Posted January 3, 2017 Author Share Posted January 3, 2017 I copied files from /var/www/html/shop/mails/en/ and now mail sends properly upon user creation. It is in english tho, do I need to translate files myself or there is a package I am missing? 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