Opencart full order details email?

Opencart full order details email?

If you want to receive the full details of an order from an opencart store, do the following.

Open catalog/model/checkout/order.php.

Notice that by doing these changes, instead of receiving the standard e-mail when someone has made an order, you will receive the e-mail that is received by the customer, with the shipping address, name etc.

If you use squiremail, click on view as HTML to view the e-mail in the correct format.

Find:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    $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();
                   }
                }            
             }

Replace with:

2
3
4
5
6
7
8
9
10
11
12
13
14
             $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();
                   }
                }            
             }

Add a comment: