We are using Opencart versions 1.5.1.2 and 1.5.1.1 for our clients. A common request we received from them is about the admin order notification email. Is it possible to improve the admin notification email to include the details Customer name, Payment status, Shipping address.
If those are added, then they can process the order even if they don't have the access to admin area.
I think the notification customer receives contains the above details.
Any help greatly appreciated to add the above details.
And is it possible to make the email notification in HTML format if the receiving email client have the ability to display the email in HTML. If not the text version will be displayed.
Thanks in advance.
If those are added, then they can process the order even if they don't have the access to admin area.
I think the notification customer receives contains the above details.
Any help greatly appreciated to add the above details.
And is it possible to make the email notification in HTML format if the receiving email client have the ability to display the email in HTML. If not the text version will be displayed.
Thanks in advance.
The easiest solution if for you to receive an exact copy of the customers email.
open catalog/model/checkout/order.php
find
change to
open catalog/model/checkout/order.php
find
Code: Select all
$mail->setTo($this->config->get('config_email')); // Admin Alert Mail
if ($this->config->get('config_alert_mail')) {
$subject = sprintf($language->get('text_new_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $order_id);
// Text
$text = $language->get('text_new_received') . "\n\n";
$text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
$text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
$text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
$text .= $language->get('text_new_products') . "\n";
foreach ($order_product_query->rows as $result) {
$text .= $result['quantity'] . 'x ' . $result['name'] . ' (' . $result['model'] . ') ' . html_entity_decode($this->currency->format($result['total'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n";
$order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . $result['order_product_id'] . "'");
foreach ($order_option_query->rows as $option) {
$text .= chr(9) . '-' . $option['name'] . (strlen($option['value']) > 20 ? substr($option['value'], 0, 20) . '..' : $option['value']) . "\n";
}
}
$text .= "\n";
$text.= $language->get('text_new_order_total') . "\n";
foreach ($order_total_query->rows as $result) {
$text .= $result['title'] . ' ' . html_entity_decode($result['text'], ENT_NOQUOTES, 'UTF-8') . "\n";
}
$text .= "\n";
if ($order_info['comment'] != '') {
$comment = ($order_info['comment'] . "\n\n" . $comment);
}
if ($comment) {
$text .= $language->get('text_new_comment') . "\n\n";
$text .= $comment . "\n\n";
}
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject($subject);
$mail->setText($text);
$mail->send();
// Send to additional alert emails
$emails = explode(',', $this->config->get('config_alert_emails'));
foreach ($emails as $email) {
if ($email && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
Code: Select all
$mail->setTo($this->config->get('config_email'));
$mail->send();
// Admin Alert Mail
if ($this->config->get('config_alert_mail')) {
$emails = explode(',', $this->config->get('config_alert_emails'));
foreach ($emails as $email) {
if ($email && preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
Thank you very much!uksitebuilder wrote:The easiest solution if for you to receive an exact copy of the customers email.
But how can I add the Order Status and Additional Comments made by the customer to that email too?
Changes to be made at order.tpl only or what?
OC version 1.5.1.3
catalog/model/checkout/order.php
find
add before
find
add after
open: catalog/view/theme/default/template/mail/order.tpl
find
add after
find
add before
find
Code: Select all
$template->data['text_footer'] = $language->get('text_new_footer');
Code: Select all
$template->data['text_new_order_status'] = $language->get('text_new_order_status');
$template->data['text_update_comment'] = $language->get('text_update_comment');
Code: Select all
$template->data['ip'] = $order_info['ip'];
Code: Select all
$template->data['order_status'] = $order_status;
$template->data['order_comment'] = $order_info['comment'];
find
Code: Select all
<b><?php echo $text_telephone; ?></b> <?php echo $telephone; ?><br />
Code: Select all
<b><?php echo $text_new_order_status; ?></b> <?php echo $order_status; ?><br />
Code: Select all
<p><?php echo $text_footer; ?></p>
Code: Select all
<?php if($order_comment!=''){ ?> <table class="list">
<thead>
<tr>
<td class="left"><?php echo $text_update_comment; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td class="left"><?php echo nl2br($order_comment); ?></td>
</tr>
</tbody>
</table><?php } ?>
For those who want it, attached is a vQmod file
Tested on 1.5.1.1/2/3
Tested on 1.5.1.1/2/3
I am really appreciate! Thank you again!uksitebuilder wrote:catalog/model/checkout/order.php
find..........Code: Select all
$template->data['text_footer'] = $language->get('text_new_footer');
Just a note, it should be $text_new_comment instead of $text_update_comment.
It does not make any difference if you never edit the description at the catalog/language/[your language]/mail/order.php.
I realised the difference just because I am using a different language and have the different custom description for both.
Another note for this HTML email.
From my test, Gmail won't show the CSS styling, therefore the presentation is no so nice. I changed it to inline style then the borders & header shades all shows and works well.
OC version 1.5.1.3
Thank you uksitebuilder. I wish to ask about the text appearing in the order notification email. That might be correct for the customer view.
"Thank you for your interest in {Store Name}. Your order has been received and will be processed once payment has been confirmed."
Anyway of modifying this text to different one in admin order notification?
And I have two small questions.
- Will this send/display the text version of email if the receiver email client doesn't support html?
- Payment status will be included in the admin order notification email?
@joy will you mind sharing your edited code with us.
Thanks again.
"Thank you for your interest in {Store Name}. Your order has been received and will be processed once payment has been confirmed."
Anyway of modifying this text to different one in admin order notification?
And I have two small questions.
- Will this send/display the text version of email if the receiver email client doesn't support html?
- Payment status will be included in the admin order notification email?
@joy will you mind sharing your edited code with us.
Thanks again.
The above can be changed at catalog/language/english/mail/order.phpbmekwa wrote: "Thank you for your interest in {Store Name}. Your order has been received and will be processed once payment has been confirmed."
Anyway of modifying this text to different one in admin order notification?
Look for $_['text_new_greeting'] .
Remember, uksitebuilder's solution is to let the admin receive an exact copy of the same email that the customer received after placing the order. Treat it as a cc copy, which means anything you changed is what the customer will get to read.
If what you want is different notification email for admin and customer respectively after an order has been placed, you should look at this thread.
Yes, but on top of adding the order status and customer order comments, I also changed the presentation of the email.bmekwa wrote:@joy will you mind sharing your edited code with us.
Here is the sample (I don't know much about codes or scripts, i hope it works for you, as it does for me.) :
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $title; ?></title>
</head>
<body style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 12px;">
<div style="width: 680px;"><a href="<?php echo $store_url; ?>" title="<?php echo $store_name; ?>"><img src="<?php echo $logo; ?>" alt="<?php echo $store_name; ?>" style="margin-bottom: 20px; border: none;" width="200" height="69" /></a>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
<?php if ($customer_id) { ?>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_link; ?></p>
<p style="margin-top: 0px; margin-bottom: 20px;"><a href="<?php echo $link; ?>"><?php echo $link; ?></a></p>
<?php } ?>
<?php if ($download) { ?>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_download; ?></p>
<p style="margin-top: 0px; margin-bottom: 20px;"><a href="<?php echo $download; ?>"><?php echo $download; ?></a></p>
<?php } ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;" colspan="2"><?php echo $text_new_order_status; ?> <?php echo $order_status; ?></td> <!-- add the order status -->
</tr>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;" colspan="2"><?php echo $text_order_detail; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td style="vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><b><?php echo $text_order_id; ?></b> <?php echo $order_id; ?><br />
<b><?php echo $text_date_added; ?></b> <?php echo $date_added; ?><br />
<b><?php echo $text_payment_method; ?></b> <?php echo $payment_method; ?><br />
<?php if ($shipping_method) { ?>
<b><?php echo $text_shipping_method; ?></b> <?php echo $shipping_method; ?>
<?php } ?></td>
<td style="vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><b><?php echo $text_email; ?></b> <?php echo $email; ?><br />
<b><?php echo $text_telephone; ?></b> <?php echo $telephone; ?><br />
<!-- <b><?php echo $text_new_order_status; ?></b> <?php echo $order_status; ?><br /> add the order status -->
<b><?php echo $text_ip; ?></b> <?php echo $ip; ?><br /></td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_payment_address; ?></td>
<?php if ($shipping_address) { ?>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_shipping_address; ?></td>
<?php } ?>
</tr>
</thead>
<tbody>
<tr>
<td style="vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $payment_address; ?></td>
<?php if ($shipping_address) { ?>
<td style="vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $shipping_address; ?></td>
<?php } ?>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_product; ?></td>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_model; ?></td>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_quantity; ?></td>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_price; ?></td>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_total; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) { ?>
<tr>
<td style="vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $product['name']; ?>
<?php foreach ($product['option'] as $option) { ?>
<br />
<small> - <?php echo $option['name']; ?>: <?php echo $option['value']; ?></small>
<?php } ?></td>
<td style="vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $product['model']; ?></td>
<td style="vertical-align: top; padding: 0px 5px; text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $product['quantity']; ?></td>
<td style="vertical-align: top; padding: 0px 5px; text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $product['price']; ?></td>
<td style="vertical-align: top; padding: 0px 5px; text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $product['total']; ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<?php foreach ($totals as $total) { ?>
<tr>
<td colspan="4" style="text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><b><?php echo $total['title']; ?>:</b></td>
<td style="text-align: right; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
</tfoot>
</table>
<!-- add on order comments by customer -->
<?php if($order_comment!=''){ ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_new_comment; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo nl2br($order_comment); ?></td>
</tr>
</tbody>
</table><?php } ?>
<?php if ($comment) { ?>
<table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
<thead>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; background-color: #EFEFEF; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $text_instruction; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td style="text-decoration: none; color: #222222; font-weight: bold; vertical-align: top; padding: 0px 5px; text-align: left; padding: 7px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;"><?php echo $comment; ?></td>
</tr>
</tbody>
</table>
<?php } ?>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_footer; ?></p>
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_powered; ?></p>
</div>
</body>
</html>
OC version 1.5.1.3
uksitebuilder wrote:For those who want it, attached is a vQmod file
Tested on 1.5.1.1/2/3
Ehhh....who wants it not? Ordermails to the storeowner should be treated standard this way in OC.
Thanx a lot. Works fine.
OC version 1.5.4.1
Simon,
Thank you so much for the VQMod version of the invoice - I have been bothered by the standard emails that we receive internally ever since upgrading. Your bit of code made the change easy.
Thanks again!
Thank you so much for the VQMod version of the invoice - I have been bothered by the standard emails that we receive internally ever since upgrading. Your bit of code made the change easy.
Thanks again!
Checkout Our OpenCart powered Stores
Sandcarving Systems | Glass Banks
"RESOLVED": i have set all files and folders in vqmod folder to 777 and... TA-DA... it worx, but this is a crazy solution. So i have a problem with file permissions, can u help me with this now? If u suggest me the right permissions i can apply to my files and folders.
And.. finally... a guide to OC file permissions?
Best.
And.. finally... a guide to OC file permissions?
Best.
Who is online
Users browsing this forum: No registered users and 284 guests