From c6410cebe6782356f76c30717d5edd5549b48e7b Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 6 Oct 2023 18:40:35 +0530 Subject: [PATCH 1/3] update cancelled mail content --- classes/Mail.php | 1 + classes/order/OrderHistory.php | 18 ++++++++ controllers/admin/AdminOrdersController.php | 22 ++++++++++ mails/en/order_canceled.html | 46 ++++++++++++++++++--- mails/en/order_canceled.txt | 14 ++++++- 5 files changed, 94 insertions(+), 7 deletions(-) diff --git a/classes/Mail.php b/classes/Mail.php index 2e321aa6a..d4caa5291 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -338,6 +338,7 @@ public static function Send($id_lang, $template, $subject, $template_vars, $to, $template_vars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME', null, null, $id_shop)); $template_vars['{shop_url}'] = Context::getContext()->link->getPageLink('index', true, $id_lang, null, false, $id_shop); $template_vars['{my_account_url}'] = Context::getContext()->link->getPageLink('my-account', true, $id_lang, null, false, $id_shop); + $template_vars['{refund_requests_url}'] = Context::getContext()->link->getPageLink('order-follow', true, $id_lang, null, false, $id_shop); $template_vars['{guest_tracking_url}'] = Context::getContext()->link->getPageLink('guest-tracking', true, $id_lang, null, false, $id_shop); $template_vars['{history_url}'] = Context::getContext()->link->getPageLink('history', true, $id_lang, null, false, $id_shop); $template_vars['{color}'] = Tools::safeOutput(Configuration::get('PS_MAIL_COLOR', null, null, $id_shop)); diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index 49c5db350..5901eb213 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -420,11 +420,29 @@ public function sendEmail($order, $template_vars = false) '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{order_name}' => $order->getUniqReference(), + '{total_paid_real}' => Tools::displayPrice($order->total_paid_real, (int)$order->id_currency), + '{is_advance_payment}' => $order->is_advance_payment, + '{advance_paid_amount}' => Tools::displayPrice($order->advance_paid_amount, (int)$order->id_currency), '{extra_mail_content_html}' => '', '{extra_mail_content_txt}' => '', '{payment_method}' => '', ); + if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + $objHotelBranchInformation = new HotelBranchInformation($idHotel, $order->id_lang); + $fields = array_merge( + $objHotelBranchInformation->getFields(), + $objHotelBranchInformation->getFieldsLang()[$order->id_lang], + $objHotelBranchInformation->getAddress($idHotel, $order->id_lang) + ); + foreach ($fields as $key => $value) { + $data['{hotel_'.$key.'}'] = $value; + } + $objHotelBookingDetail = new HotelBookingDetail(); + $hotelBookingDetail = $objHotelBookingDetail->getBookingDataByOrderId($order->id); + $data['{num_rooms}'] = count($hotelBookingDetail); + } + if ($result['module_name']) { if (Validate::isLoadedObject($module = Module::getInstanceByName($result['module_name']))) { $data['{payment_method}'] = $module->displayName; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 63a271ecd..2fe93cdeb 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -683,6 +683,28 @@ public function postProcess() /* Change order status, add a new entry in order history and send an e-mail to the customer if needed */ elseif (Tools::isSubmit('submitState') && isset($order)) { + // $data = array( + // '{total_paid}' => Tools::displayPrice($order->total_paid, (int)$order->id_currency), + // '{total_paid_real}' => Tools::displayPrice($order->total_paid_real, (int)$order->id_currency), + // '{is_advance_payment}' => $order->is_advance_payment, + // '{advance_paid_amount}' => Tools::displayPrice($order->advance_paid_amount, (int)$order->id_currency), + // ); + // if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + // $objHotelBranchInformation = new HotelBranchInformation($idHotel, $order->id_lang); + // $fields = array_merge( + // $objHotelBranchInformation->getFields(), + // $objHotelBranchInformation->getFieldsLang()[$order->id_lang], + // $objHotelBranchInformation->getAddress($idHotel, $order->id_lang) + // ); + // foreach ($fields as $key => $value) { + // $data['{hotel_'.$key.'}'] = $value; + // } + // $objHotelBookingDetail = new HotelBookingDetail(); + // $hotelBookingDetail = $objHotelBookingDetail->getBookingDataByOrderId($order->id); + // $data['{num_rooms}'] = count($hotelBookingDetail); + + // } + // ddd($data); if ($this->tabAccess['edit'] === '1') { $order_state = new OrderState(Tools::getValue('id_order_state')); diff --git a/mails/en/order_canceled.html b/mails/en/order_canceled.html index a724ba3ab..939ff1d5d 100644 --- a/mails/en/order_canceled.html +++ b/mails/en/order_canceled.html @@ -85,9 +85,45 @@

- Order {order_name} - Order canceled

- - Your order with the reference {order_name} from {shop_name} has been canceled. + Order {order_name} - Order canceled +

+ Your order with the reference {order_name} from {shop_name} has been canceled. +
+ +   + + + + + +   + + + + + + + @@ -103,7 +139,7 @@ @@ -111,7 +147,7 @@ diff --git a/mails/en/order_canceled.txt b/mails/en/order_canceled.txt index d79911a36..d1d15ee9f 100644 --- a/mails/en/order_canceled.txt +++ b/mails/en/order_canceled.txt @@ -6,10 +6,20 @@ Hi {firstname} {lastname}, Your order with the reference {order_name} from {shop_name} has been canceled. +Here are your order details: +Order reference: {order_name} +Order total: {total_paid} +Total Rooms: {num_rooms} + +Hotel details: +Hotel Name: {hotel_hotel_name} +Hotel Phone: {hotel_phone} +Hotel Email: {hotel_email} + {extra_mail_content_txt} -You can review your order and download your invoice from the -"Order history" [/{history_url}] section of your customer account by +You can review your cancelation request from the +"Booking refund request" [/{refund_requests_url}] section of your customer account by clicking "My account" [/{my_account_url}] on our website. If you have a guest account, you can follow your order via the From 7324dd688127d61d9cb6498015fa6abd8f50e6a2 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 5 Dec 2023 11:26:32 +0530 Subject: [PATCH 2/3] remove commented code --- controllers/admin/AdminOrdersController.php | 22 --------------------- 1 file changed, 22 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 2fe93cdeb..63a271ecd 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -683,28 +683,6 @@ public function postProcess() /* Change order status, add a new entry in order history and send an e-mail to the customer if needed */ elseif (Tools::isSubmit('submitState') && isset($order)) { - // $data = array( - // '{total_paid}' => Tools::displayPrice($order->total_paid, (int)$order->id_currency), - // '{total_paid_real}' => Tools::displayPrice($order->total_paid_real, (int)$order->id_currency), - // '{is_advance_payment}' => $order->is_advance_payment, - // '{advance_paid_amount}' => Tools::displayPrice($order->advance_paid_amount, (int)$order->id_currency), - // ); - // if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { - // $objHotelBranchInformation = new HotelBranchInformation($idHotel, $order->id_lang); - // $fields = array_merge( - // $objHotelBranchInformation->getFields(), - // $objHotelBranchInformation->getFieldsLang()[$order->id_lang], - // $objHotelBranchInformation->getAddress($idHotel, $order->id_lang) - // ); - // foreach ($fields as $key => $value) { - // $data['{hotel_'.$key.'}'] = $value; - // } - // $objHotelBookingDetail = new HotelBookingDetail(); - // $hotelBookingDetail = $objHotelBookingDetail->getBookingDataByOrderId($order->id); - // $data['{num_rooms}'] = count($hotelBookingDetail); - - // } - // ddd($data); if ($this->tabAccess['edit'] === '1') { $order_state = new OrderState(Tools::getValue('id_order_state')); From daa8f392eeac1305b62468c854392afab3abeb58 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 13 Mar 2024 19:04:33 +0530 Subject: [PATCH 3/3] update order cancellation mail --- classes/Mail.php | 1 - mails/en/order_canceled.html | 6 +++--- mails/en/order_canceled.txt | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/classes/Mail.php b/classes/Mail.php index d4caa5291..2e321aa6a 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -338,7 +338,6 @@ public static function Send($id_lang, $template, $subject, $template_vars, $to, $template_vars['{shop_name}'] = Tools::safeOutput(Configuration::get('PS_SHOP_NAME', null, null, $id_shop)); $template_vars['{shop_url}'] = Context::getContext()->link->getPageLink('index', true, $id_lang, null, false, $id_shop); $template_vars['{my_account_url}'] = Context::getContext()->link->getPageLink('my-account', true, $id_lang, null, false, $id_shop); - $template_vars['{refund_requests_url}'] = Context::getContext()->link->getPageLink('order-follow', true, $id_lang, null, false, $id_shop); $template_vars['{guest_tracking_url}'] = Context::getContext()->link->getPageLink('guest-tracking', true, $id_lang, null, false, $id_shop); $template_vars['{history_url}'] = Context::getContext()->link->getPageLink('history', true, $id_lang, null, false, $id_shop); $template_vars['{color}'] = Tools::safeOutput(Configuration::get('PS_MAIL_COLOR', null, null, $id_shop)); diff --git a/mails/en/order_canceled.html b/mails/en/order_canceled.html index 939ff1d5d..6b8af18f2 100644 --- a/mails/en/order_canceled.html +++ b/mails/en/order_canceled.html @@ -85,7 +85,7 @@ @@ -147,7 +147,7 @@ diff --git a/mails/en/order_canceled.txt b/mails/en/order_canceled.txt index d1d15ee9f..41a78ac30 100644 --- a/mails/en/order_canceled.txt +++ b/mails/en/order_canceled.txt @@ -18,8 +18,8 @@ Hotel Email: {hotel_email} {extra_mail_content_txt} -You can review your cancelation request from the -"Booking refund request" [/{refund_requests_url}] section of your customer account by +You can review your order and download your invoice from the +"Order history" [/{history_url}] section of your customer account by clicking "My account" [/{my_account_url}] on our website. If you have a guest account, you can follow your order via the
  + +

+ Here are your order details: +

+

+ Order reference: {order_name}
+ Order total: {total_paid}
+ Total Rooms: {num_rooms}
+

+
+
+ +

+ Hotel details: +

+

+ Hotel Name: {hotel_hotel_name}
+ Hotel Phone: {hotel_phone}
+ Hotel Email: {hotel_email}
+

  - You can review your order and download your invoice from the "Order history" section of your customer account by clicking "My account" on our website. + You can review your cancelation request from the "Booking refund request" section of your customer account by clicking "My account" on our website.
- If you have a guest account, you can follow your order via the "Guest Tracking" section on our website. + If you have a guest account, you can follow your order via the "Guest Tracking" section on our website.

- Order {order_name} - Order canceled + Order canceled - {order_name}

Your order with the reference {order_name} from {shop_name} has been canceled.
@@ -139,7 +139,7 @@
- You can review your cancelation request from the "Booking refund request" section of your customer account by clicking "My account" on our website. + You can review your order and download your invoice from the "Order history" section of your customer account by clicking "My account" on our website.
- If you have a guest account, you can follow your order via the "Guest Tracking" section on our website. + If you have a guest account, you can follow your order via the "Guest Tracking" section on our website.