diff --git a/config/app.php b/config/app.php index 33129e719..3a6ec6903 100755 --- a/config/app.php +++ b/config/app.php @@ -102,6 +102,8 @@ return [ | Ensure it is uppercase and reflects the 'code' column of the | countries table. | + | for example: DE EN FR + | (use capital letters!) */ 'default_country' => null, diff --git a/packages/Webkul/API/Http/Resources/Checkout/Cart.php b/packages/Webkul/API/Http/Resources/Checkout/Cart.php index 2a6401b9e..028d42f43 100644 --- a/packages/Webkul/API/Http/Resources/Checkout/Cart.php +++ b/packages/Webkul/API/Http/Resources/Checkout/Cart.php @@ -16,6 +16,12 @@ class Cart extends JsonResource */ public function toArray($request) { + $taxes = \Webkul\Tax\Helpers\Tax::getTaxRatesWithAmount($this, false); + $baseTaxes = \Webkul\Tax\Helpers\Tax::getTaxRatesWithAmount($this, true); + + $formatedTaxes = $this->formatTaxAmounts($taxes, false); + $formatedBaseTaxes = $this->formatTaxAmounts($baseTaxes, true); + return [ 'id' => $this->id, 'customer_email' => $this->customer_email, @@ -60,6 +66,31 @@ class Cart extends JsonResource 'shipping_address' => new CartAddress($this->shipping_address), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, + 'taxes' => json_encode($taxes, JSON_FORCE_OBJECT), + 'formated_taxes' => json_encode($formatedTaxes, JSON_FORCE_OBJECT), + 'base_taxes' => json_encode($baseTaxes, JSON_FORCE_OBJECT), + 'formated_base_taxes' => json_encode($formatedBaseTaxes, JSON_FORCE_OBJECT), ]; } + + /** + * @param array $taxes + * @param bool $isBase + * + * @return array + */ + private function formatTaxAmounts(array $taxes, bool $isBase = false): array + { + $result = []; + + foreach ($taxes as $taxRate => $taxAmount) { + if ($isBase === true) { + $result[$taxRate] = core()->formatBasePrice($taxAmount); + } else { + $result[$taxRate] = core()->formatPrice($taxAmount, $this->cart_currency_code); + } + } + + return $result; + } } \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php index a1b28cbd0..dcf5d8872 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php @@ -266,7 +266,7 @@ @if (isset($item->additional['attributes']))
| {{ __('shop::app.customer.account.order.view.product-name') }} | -{{ __('shop::app.customer.account.order.view.price') }} | -{{ __('shop::app.customer.account.order.view.qty') }} | -|||
|---|---|---|---|---|---|
| {{ __('shop::app.customer.account.order.view.product-name') }} | +{{ __('shop::app.customer.account.order.view.price') }} | +{{ __('shop::app.customer.account.order.view.qty') }} | +|||
|
- {{ $item->name }}
-
- @if (isset($item->additional['attributes']))
-
-
- @foreach ($item->additional['attributes'] as $attribute)
- {{ $attribute['attribute_name'] }} : {{ $attribute['option_label'] }}
- @endforeach
+ @foreach ($invoice->items as $item)
+
+ @endif
+
+ {{ $item->name }}
-
- @endif
- |
+ @if (isset($item->additional['attributes']))
+
- {{ core()->formatPrice($item->price, $order->order_currency_code) }}
- |
+ @foreach ($item->additional['attributes'] as $attribute)
+ {{ $attribute['attribute_name'] }}
+ : {{ $attribute['option_label'] }}
+ @endforeach
- {{ $item->qty }} |
- |
- @endforeach
+ {{ core()->formatPrice($item->price, $order->order_currency_code) }} + | + +{{ $item->qty }} | +
{!! __('shop::app.mail.order.help', [ diff --git a/packages/Webkul/Shop/src/Resources/views/emails/sales/new-order.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-order.blade.php index 2d848b5ca..a1b58f641 100755 --- a/packages/Webkul/Shop/src/Resources/views/emails/sales/new-order.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-order.blade.php @@ -116,10 +116,10 @@