Page 1 of 1

New order email notification template

Posted: Sat Nov 11, 2017 8:32 pm
by sergius79
Hi everyone!

I have OC 3.0.2.0 + Journal2 theme.

When I testing ordering noticed that client receive email with full order details, but oc administrator only short version (no client name, no contacts):
Client email notification: http://prntscr.com/h92558
Admin order email notification: http://prntscr.com/h925hw

How can admin receive also full order email notification?

Re: New order email notification template

Posted: Sat Nov 11, 2017 11:21 pm
by straightlight
Use a fresh installation of Opencart and see if the admin email template notification also use a short version compared to the Journal2 theme edition.

Re: New order email notification template

Posted: Sun Nov 12, 2017 5:02 pm
by sergius79
But where is the admin order email template?
I have found file /public_html/catalog/view/theme/default/template/mail/order_alert.twig which has admin mail template code http://prntscr.com/h9dotc
I have tried to change code to be sure this template is really used for admin mails but without changes. So, I am not sure this file is used.

Journal2 doesn't have it own mail template folder /public_html/catalog/view/theme/journal2/template/??????

Re: New order email notification template

Posted: Sun Nov 12, 2017 9:59 pm
by straightlight
If the order_alert.twig file can be found on the core but not on the journal2 especially with so many question marks, then clearly the issue is with Journal2. Contact the extension publisher to resolve this issue. The order alert is working fine with the core. As for the admin emails, they are located in the admin/view/template/mail folder.

Re: New order email notification template

Posted: Tue Nov 14, 2017 6:02 am
by sebastiaank
What you can easily do, is go to Design --> layout theme edit and copy the twig contents of mail/order_add.twig and paste it into mail/order_alert.twig.
you will get an exact copy of what a customer gets.

Re: New order email notification template

Posted: Thu Jan 18, 2018 9:55 pm
by rkeles
I have the same problem. admin email notifications comes with text format, not in HTML?
Does it have any solition?

Re: New order email notification template

Posted: Tue Feb 06, 2018 6:48 pm
by rkeles
No solisions?

Re: New order email notification template

Posted: Wed Feb 07, 2018 6:20 am
by straightlight
rkeles wrote:
Thu Jan 18, 2018 9:55 pm
I have the same problem. admin email notifications comes with text format, not in HTML?
Does it have any solition?
No OC version posted.

Re: New order email notification template

Posted: Wed Mar 14, 2018 4:29 am
by siptec
sebastiaank wrote:
Tue Nov 14, 2017 6:02 am
What you can easily do, is go to Design --> layout theme edit and copy the twig contents of mail/order_add.twig and paste it into mail/order_alert.twig.
you will get an exact copy of what a customer gets.
This answer does not work. The Admin receives not formatted HTML code in the email. There has to be a way for OC 3.0.2.0 to send and email to the administrator giving them the same information as the customer gets. OC 2.x was easy to change this email format...

Any help would be appreciated.

Re: New order email notification template

Posted: Wed Mar 14, 2018 5:20 am
by IP_CAM
Well, the good News is, that a Solution for OC v.3.x Versions already exists, as it looks! :D
And the bad News is, that latest Version Software Users don't find much free stuff yet... :P
But one cannot always have everything, just like in real life...
Ernie
---
Admin Email Enhancer 3 paid, OC v.3.0.0.0, 3.0.1.1, 3.0.1.2, 3.0.2.0, 3.0.3.0b:
Get rid of that text email sent to Admins on receipt of an Order.
Receive a fully formatted email containing all of the data you'll need to complete the Order:
@ Your Logo
@ Order Details: Payment method, Shipping Method, Customer details
@ Payment and Shipping addresses
@ Customer comments
@ Product details - including ordered options
@ Full totals information
@ NEW - Now includes configurable product photo(s)
---
https://www.opencart.com/index.php?rout ... n_id=32152
---
Image
Image

Re: New order email notification template

Posted: Fri Aug 10, 2018 11:52 pm
by anatom09
This one, free extension, works. Solves this problem: https://www.opencart.com/index.php?rout ... _license=0

Re: New order email notification template

Posted: Wed Mar 20, 2019 8:17 pm
by guspel
Sorry for my English
For Opencart 3.0.2.0
catalog/controller/mail/order.php

Search

Code: Select all

send();
replace by (on all occasions)

Code: Select all

send();
$this->sameAdminAlert($order_info,$data);
Search

Code: Select all

public function add($order_info, $order_status_id, $comment, $notify)
Replace by

Code: Select all

		
	public function sameAdminAlert($order_info, $data) {
		if (in_array('order', (array)$this->config->get('config_mail_alert'))) {
			$data['text_greeting'] = 'You have a new order - '.$order_info['order_id'];
			
			$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($this->config->get('config_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($order_info['store_name'] . ' - ' . $data['text_greeting'], ENT_NOQUOTES, 'UTF-8'));
			$mail->setHtml($this->load->view('mail/order_add', $data));
			$mail->send();
			
			// Send to additional alert emails
			$emails = explode(',', $this->config->get('config_mail_alert_email'));
			
			foreach ($emails as $email) {
				if ($email && filter_var($email, FILTER_VALIDATE_EMAIL)) {
					$mail->setTo($email);
					$mail->send();
				}
			}
		}
	}
	public function add($order_info, $order_status_id, $comment, $notify)

It worked for me correctly

Re: New order email notification template

Posted: Tue Sep 03, 2019 10:54 pm
by originalstormcrow
Guspel, your solution worked great.. Thank you!
It is not a real problem but now we get 3 order notifications.
1. orignal normal email notification of order.
2. an email that looks like it is saysing the order is completed.
3. is an email we want to keep with all the order details. Its beautiful.
Is there a way of just having the last email without the others.
Thank you.

Re: New order email notification template

Posted: Thu Jul 29, 2021 3:00 am
by hermanshaho
It's very simple. You don't need any modules for do this.

Below I show how to change mail / order_edit (when you notify the customer during an order update), the same applies to the other mail templates.

Follow my steps:
1) Go to catalog/controller/mail/order.php
2) Serach for "$mail->setText($this->load->view('mail/order_edit', $data));"
3) Replace it with "$mail->setHtml($this->load->view('mail/order_edit', $data));"
4) Save and test it

Basicly what we do is that we change mail template format from text to html.

Btw.. It is best practice that you create an ocmod file and run it as a custom modification so you don't overwrite the oc core files. ^-^