我正在尝试停止针对某些订单状态触发发票电子邮件,但无法找到email->send
执行此操作的位置。
我已在email->sends
中注释掉所有catalog->model->checkout->order.php
并清除了缓存,但我仍然收到了发票电子邮件。
提前谢谢。
答案 0 :(得分:0)
电子邮件是从文件发送的: 目录/型号/ checkout / order.php就像你说的那样。
让我们说您要发送电子邮件的订单的order_status_id是:7(通常是默认订单完成状态ID)
找到代码:
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$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($order_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setHtml($this->load->view('mail/order', $data));
$mail->setText($text);
$mail->send();
并用if语句包装它:
if($order_status_id == 7){
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$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($order_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setHtml($this->load->view('mail/order', $data));
$mail->setText($text);
$mail->send();
}
如果订单的status_id = 7,此更改将构建并发送电子邮件。将此order_status_id更改为您的。
重要信息: 1)如果您使用任何更改此代码的opencart扩展程序,则需要调整代码... 2)如果你的order_status_id是你的eshop的默认order_status_id,那么你永远不会收到电子邮件。小心。
希望我能帮到你。欢呼声。