Revision: 73897
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 25, 2018 20:49 by cerxx
Initial Code
<modification> <id>OCA_Detailed Order Admin Email Notification(1.5.x)</id> <version>1.0</version> <vqmver>1.0.0</vqmver> <author>Joel - http://opencartaddons.com - [email protected]</author> <file name="catalog/model/checkout/order.php"> <operation> <search position="replace"><![CDATA[$mail->setText($text);]]></search> <add><![CDATA[ $mail->setHtml($html); $mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8')); $mail->addAttachment(DIR_IMAGE . $this->config->get('config_logo')); ]]></add> </operation> <operation> <search position="before" index="2"><![CDATA[$mail = new Mail();]]></search> <add><![CDATA[ // HTML Mail $template = new Template(); $template->data['title'] = sprintf($language->get('text_new_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_id); $template->data['text_greeting'] = sprintf($language->get('text_new_received')); $template->data['text_link'] = ''; $template->data['text_download'] = ''; $template->data['text_order_detail'] = $language->get('text_new_order_detail'); $template->data['text_invoice_no'] = $language->get('text_new_invoice_no'); $template->data['text_order_id'] = $language->get('text_new_order_id'); $template->data['text_date_added'] = $language->get('text_new_date_added'); $template->data['text_payment_method'] = $language->get('text_new_payment_method'); $template->data['text_shipping_method'] = $language->get('text_new_shipping_method'); $template->data['text_email'] = $language->get('text_new_email'); $template->data['text_telephone'] = $language->get('text_new_telephone'); $template->data['text_ip'] = $language->get('text_new_ip'); $template->data['text_payment_address'] = $language->get('text_new_payment_address'); $template->data['text_shipping_address'] = $language->get('text_new_shipping_address'); $template->data['text_product'] = $language->get('text_new_product'); $template->data['text_model'] = $language->get('text_new_model'); $template->data['text_quantity'] = $language->get('text_new_quantity'); $template->data['text_price'] = $language->get('text_new_price'); $template->data['text_total'] = $language->get('text_new_total'); $template->data['text_footer'] = ''; $template->data['text_powered'] = ''; $template->data['logo'] = 'cid:' . basename($this->config->get('config_logo')); $template->data['store_name'] = $order_info['store_name']; $template->data['store_url'] = $order_info['store_url']; $template->data['customer_id'] = $order_info['customer_id']; $template->data['link'] = ''; $template->data['download'] = ''; if (isset($comment) && isset($notify)) { if ($comment && $notify) { $template->data['comment'] = nl2br($comment); } else { $template->data['comment'] = ''; } } $template->data['invoice_no'] = $invoice_no; $template->data['order_id'] = $order_id; $template->data['date_added'] = date($language->get('date_format_short'), strtotime($order_info['date_added'])); $template->data['payment_method'] = $order_info['payment_method']; $template->data['shipping_method'] = $order_info['shipping_method']; $template->data['email'] = $order_info['email']; $template->data['telephone'] = $order_info['telephone']; $template->data['ip'] = $order_info['ip'] . '<br/><b>' . $language->get('text_new_order_status') . '</b> ' . $order_status; if ($order_info['shipping_address_format']) { $format = $order_info['shipping_address_format']; } else { $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; } $find = array( '{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}' ); $replace = array( 'firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country'] ); $template->data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); if ($order_info['payment_address_format']) { $format = $order_info['payment_address_format']; } else { $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; } $find = array( '{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}' ); $replace = array( 'firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country'] ); $template->data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); $template->data['products'] = array(); foreach ($order_product_query->rows as $product) { $option_data = array(); $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'"); foreach ($order_option_query->rows as $option) { if ($option['type'] != 'file') { $option_data[] = array( 'name' => $option['name'], 'value' => (strlen($option['value']) > 20 ? substr($option['value'], 0, 20) . '..' : $option['value']) ); } else { $filename = substr($option['value'], 0, strrpos($option['value'], '.')); $option_data[] = array( 'name' => $option['name'], 'value' => (strlen($filename) > 20 ? substr($filename, 0, 20) . '..' : $filename) ); } } $template->data['products'][] = array( 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']), 'total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']) ); } $template->data['totals'] = $order_total_query->rows; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) { $html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl'); } else { $html = $template->fetch('default/template/checkout/mail/order.tpl'); } ]]></add> </operation> </file> </modification>
Initial URL
https://forum.opencart.com/viewtopic.php?t=45829#p224874
Initial Description
Allow you to change the admin notification email to the same level of detail as the customer receives.
Initial Title
OCA_Detailed Order Admin Email Notification(1.5.2) vQmod - worked on 1.5.6.4 OpenCart v1.5.x only - 2
Initial Tags
module
Initial Language
XML