Thanks for help.
Error logs. Check your OC admin > extensions > events list and your email configurations in your OC admin > systems > settings > edit settings > Mail tab.g3niuse wrote: ↑Wed Nov 17, 2021 2:46 amWhen I use returns tab in sales and select notify customer email isn't send to customer. I tried to apply fix from git hub which was linked in some other oc forum post (https://github.com/opencart/opencart/co ... 12f0b516af) but that didin't fix a problem. I am running open cart 3.0.3.3.
Thanks for help.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Are other emails from the site sending ok?
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Check the event trigger for return mail from admin in events list:
admin_mail_return
upon install it reads:
Code: Select all
admin/model/sale/return/addReturn/after
Code: Select all
admin/model/sale/return/addReturnHistory/after
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Every other email is working alright for orders and notification for changing status of order works perfectly fine.paulfeakins wrote: ↑Wed Nov 17, 2021 7:59 pmThere are a lot of things that can cause email issues.
Are other emails from the site sending ok?
I don't know if affiliate mails are working because i don't use them.
It reads like thisby mona wrote: ↑Wed Nov 17, 2021 11:26 pmI think it is a problem in 3.0.3.3.
Check the event trigger for return mail from admin in events list:
admin_mail_return
upon install it reads:should it not be:Code: Select all
admin/model/sale/return/addReturn/after
Code: Select all
admin/model/sale/return/addReturnHistory/after
Code: Select all
admin/model/sale/return/addReturn/after
Thanks for Help
From phpMyAdmin, xx_event table
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Code: Select all
admin/model/sale/return/addReturnHistory/after
in admin/controller/mail/return.php
you add:
Code: Select all
$this->log->write('About to send an email for return: '.$return_id.' to '.$return_info['email']);
Code: Select all
$mail->setTo($return_info['email']);
if it is, the trigger is ok, if you still do not get an email, you have an email processing issue.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
First you need to change event to
Code: Select all
admin/model/sale/return/addReturnHistory/after
You need to delete this lanes if you implemented the fix from github
Code: Select all
$language_info = $this->model_localisation_language->getLanguage($return_info['language_id']);
if ($language_info) {
$language_code = $language_info['code'];
} else {
$language_code = $this->config->get('config_language');
}
Then you need to change line
Code: Select all
$language = new Language($language_code);
$language->load($language_code);
$language->load('mail/return');
Code: Select all
$language = new Language('en-gb');
$language->load('en-gb');
$language->load('mail/return');
This part is so funny because someone forgot to add all data needed for email body
After this lines
Code: Select all
$data['return_id'] = $return_id;
$data['date_added'] = date($language->get('date_format_short'), strtotime($return_info['date_modified']));
$data['return_status'] = $return_info['return_status'];
$data['comment'] = strip_tags(html_entity_decode($comment, ENT_QUOTES, 'UTF-8'));
Code: Select all
$data['text_return_id']=$language->get('text_return_id');
$data['text_date_added']=$language->get('text_date_added');
$data['text_return_status']=$language->get('text_return_status');
$data['text_comment']=$language->get('text_comment');
$data['text_footer']=$language->get('text_footer');
In the end complete file should look like this
Code: Select all
<?php
class ControllerMailReturn extends Controller {
public function index($route, $args, $output) {
if (isset($args[0])) {
$return_id = $args[0];
} else {
$return_id = '';
}
if (isset($args[1])) {
$return_status_id = $args[1];
} else {
$return_status_id = '';
}
if (isset($args[2])) {
$comment = $args[2];
} else {
$comment = '';
}
if (isset($args[3])) {
$notify = $args[3];
} else {
$notify = '';
}
if ($notify) {
$this->load->model('sale/return');
$return_info = $this->model_sale_return->getReturn($return_id);
if ($return_info) {
$language = new Language('en-gb');
$language->load('en-gb');
$language->load('mail/return');
$data['return_id'] = $return_id;
$data['date_added'] = date($language->get('date_format_short'), strtotime($return_info['date_modified']));
$data['return_status'] = $return_info['return_status'];
$data['comment'] = strip_tags(html_entity_decode($comment, ENT_QUOTES, 'UTF-8'));
$data['text_return_id']=$language->get('text_return_id');
$data['text_date_added']=$language->get('text_date_added');
$data['text_return_status']=$language->get('text_return_status');
$data['text_comment']=$language->get('text_comment');
$data['text_footer']=$language->get('text_footer');
$mail = new Mail($this->config->get('config_mail_engine'));
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setTo($return_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
$mail->setSubject(sprintf($language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $return_id));
$mail->setText($this->load->view('mail/return', $data));
$mail->send();
}
}
}
}
I tried all fixes I could find but to no avail.
In the end I purchased this extension that was the solution for me:
https://www.opencart.com/index.php?rout ... n_id=44589
You can switch admin E-mails and customer-emails on and off or both. It is multilingual and uses html for styling.
I'm happy with it and it works like a charm.
Users browsing this forum: No registered users and 10 guests