diff --git a/packages/Webkul/Admin/src/Listeners/Order.php b/packages/Webkul/Admin/src/Listeners/Order.php index f2e1c06c5..7bebf23b9 100755 --- a/packages/Webkul/Admin/src/Listeners/Order.php +++ b/packages/Webkul/Admin/src/Listeners/Order.php @@ -3,14 +3,15 @@ namespace Webkul\Admin\Listeners; use Illuminate\Support\Facades\Mail; -use Webkul\Admin\Mail\NewOrderNotification; use Webkul\Admin\Mail\NewAdminNotification; -use Webkul\Admin\Mail\NewInvoiceNotification; -use Webkul\Admin\Mail\NewShipmentNotification; -use Webkul\Admin\Mail\NewInventorySourceNotification; -use Webkul\Admin\Mail\CancelOrderNotification; +use Webkul\Admin\Mail\NewOrderNotification; use Webkul\Admin\Mail\NewRefundNotification; +use Webkul\Admin\Mail\NewInvoiceNotification; +use Webkul\Admin\Mail\CancelOrderNotification; +use Webkul\Admin\Mail\NewShipmentNotification; use Webkul\Admin\Mail\OrderCommentNotification; +use Webkul\Admin\Mail\CancelOrderAdminNotification; +use Webkul\Admin\Mail\NewInventorySourceNotification; class Order { @@ -117,10 +118,18 @@ class Order public function sendCancelOrderMail($order) { try { + /* email to customer */ $configKey = 'emails.general.notifications.emails.general.notifications.cancel-order'; if (core()->getConfigData($configKey)) { Mail::queue(new CancelOrderNotification($order)); } + + /* email to admin */ + $configKey = 'emails.general.notifications.emails.general.notifications.new-admin'; + if (core()->getConfigData($configKey)) { + app()->setLocale(env('APP_LOCALE')); + Mail::queue(new CancelOrderAdminNotification($order)); + } } catch (\Exception $e) { report($e); } diff --git a/packages/Webkul/Admin/src/Mail/CancelOrderAdminNotification.php b/packages/Webkul/Admin/src/Mail/CancelOrderAdminNotification.php new file mode 100644 index 000000000..81f308bf2 --- /dev/null +++ b/packages/Webkul/Admin/src/Mail/CancelOrderAdminNotification.php @@ -0,0 +1,34 @@ +order = $order; + } + + public function build() + { + return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name']) + ->to(core()->getAdminEmailDetails()['email']) + ->subject(trans('shop::app.mail.order.cancel.subject')) + ->view('shop::emails.sales.order-cancel-admin'); + } +} \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php index a36510572..ab15f52ad 100755 --- a/packages/Webkul/Shop/src/Resources/lang/en/app.php +++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php @@ -592,7 +592,7 @@ return [ 'subject' => 'Order Cancel Confirmation', 'heading' => 'Order Cancelled', 'dear' => 'Dear :customer_name', - 'greeting' => 'You Order with order id #:order_id placed on :created_at has been cancelled', + 'greeting' => 'Your Order with order id :order_id placed on :created_at has been cancelled', 'summary' => 'Summary of Order', 'shipping-address' => 'Shipping Address', 'billing-address' => 'Billing Address', diff --git a/packages/Webkul/Shop/src/Resources/views/emails/sales/order-cancel-admin.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/sales/order-cancel-admin.blade.php new file mode 100644 index 000000000..b768036de --- /dev/null +++ b/packages/Webkul/Shop/src/Resources/views/emails/sales/order-cancel-admin.blade.php @@ -0,0 +1,212 @@ +@component('shop::emails.layouts.master') +
+ + @if (core()->getConfigData('general.design.admin_logo.logo_image')) + {{ config('app.name') }} + @else + {{ config('app.name') }} + @endif + +
+ +
+
+ + {{ __('shop::app.mail.order.cancel.heading') }} +
+ +

+ {{ __('shop::app.mail.order.cancel.dear', ['customer_name' => config('mail.from.name')]) }}, +

+ +

+ {!! __('shop::app.mail.order.cancel.greeting', [ + 'order_id' => '#' . $order->increment_id . '', + 'created_at' => $order->created_at + ]) + !!} +

+
+ +
+ {{ __('shop::app.mail.order.cancel.summary') }} +
+ +
+
+
+ {{ __('shop::app.mail.order.cancel.shipping-address') }} +
+ +
+ {{ $order->shipping_address->company_name ?? '' }} +
+ +
+ {{ $order->shipping_address->name }} +
+ +
+ {{ $order->shipping_address->address1 }}, {{ $order->shipping_address->state }} +
+ +
+ {{ core()->country_name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }} +
+ +
---
+ +
+ {{ __('shop::app.mail.order.cancel.contact') }} : {{ $order->shipping_address->phone }} +
+ +
+ {{ __('shop::app.mail.order.cancel.shipping') }} +
+ +
+ {{ $order->shipping_title }} +
+
+ +
+
+ {{ __('shop::app.mail.order.cancel.billing-address') }} +
+ +
+ {{ $order->billing_address->company_name ?? '' }} +
+ +
+ {{ $order->billing_address->name }} +
+ +
+ {{ $order->billing_address->address1 }}, {{ $order->billing_address->state }} +
+ +
+ {{ core()->country_name($order->billing_address->country) }} {{ $order->billing_address->postcode }} +
+ +
---
+ +
+ {{ __('shop::app.mail.order.cancel.contact') }} : {{ $order->billing_address->phone }} +
+ +
+ {{ __('shop::app.mail.order.cancel.payment') }} +
+ +
+ {{ core()->getConfigData('sales.paymentmethods.' . $order->payment->method . '.title') }} +
+
+
+ +
+
+ + + + + + + + + + + + @foreach ($order->items as $item) + + + + + + + + + + @endforeach + +
{{ __('shop::app.customer.account.order.view.SKU') }}{{ __('shop::app.customer.account.order.view.product-name') }}{{ __('shop::app.customer.account.order.view.price') }}{{ __('shop::app.customer.account.order.view.qty') }}
+ {{ $item->child ? $item->child->sku : $item->sku }} + + {{ $item->name }} + + @if (isset($item->additional['attributes'])) +
+ + @foreach ($item->additional['attributes'] as $attribute) + {{ $attribute['attribute_name'] }} : {{ $attribute['option_label'] }}
+ @endforeach + +
+ @endif +
+ {{ core()->formatPrice($item->price, $order->order_currency_code) }} + + {{ $item->qty_canceled }} +
+
+
+ +
+
+ {{ __('shop::app.mail.order.cancel.subtotal') }} + + {{ core()->formatPrice($order->sub_total, $order->order_currency_code) }} + +
+ +
+ {{ __('shop::app.mail.order.cancel.shipping-handling') }} + + {{ core()->formatPrice($order->shipping_amount, $order->order_currency_code) }} + +
+ + @foreach (Webkul\Tax\Helpers\Tax::getTaxRatesWithAmount($order, false) as $taxRate => $taxAmount ) +
+ {{ __('shop::app.mail.order.cancel.tax') }} {{ $taxRate }} % + + {{ core()->formatPrice($taxAmount, $order->order_currency_code) }} + +
+ @endforeach + + @if ($order->discount_amount > 0) +
+ {{ __('shop::app.mail.order.cancel.discount') }} + + {{ core()->formatPrice($order->discount_amount, $order->order_currency_code) }} + +
+ @endif + +
+ {{ __('shop::app.mail.order.cancel.grand-total') }} + + {{ core()->formatPrice($order->grand_total, $order->order_currency_code) }} + +
+
+ +
+

+ {!! + __('shop::app.mail.order.cancel.help', [ + 'support_email' => '' . config('mail.from.address'). '' + ]) + !!} +

+ +

+ {{ __('shop::app.mail.order.cancel.thanks') }} +

+
+
+@endcomponent \ No newline at end of file