diff --git a/packages/Sarga/API/Http/Resources/Checkout/CartItemResource.php b/packages/Sarga/API/Http/Resources/Checkout/CartItemResource.php index c0e3523c7..b52dd8147 100644 --- a/packages/Sarga/API/Http/Resources/Checkout/CartItemResource.php +++ b/packages/Sarga/API/Http/Resources/Checkout/CartItemResource.php @@ -21,13 +21,13 @@ class CartItemResource extends JsonResource 'name' => $this->name, 'base_total_weight' => (double)$this->base_total_weight, 'price' => (double)$this->price, - 'formatted_price' => core()->formatPrice($this->base_price, $this->cart->cart_currency_code), + 'formatted_price' => core()->formatPrice($this->price, $this->cart->cart_currency_code), 'custom_price' => (double)$this->custom_price, 'total' => (double)$this->total, - 'formatted_total' => core()->formatPrice($this->base_total, $this->cart->cart_currency_code), + 'formatted_total' => core()->formatPrice($this->total, $this->cart->cart_currency_code), 'discount_percent' => $this->discount_percent, 'discount_amount' => (double)$this->discount_amount, - 'formatted_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->cart->cart_currency_code), + 'formatted_discount_amount' => core()->formatPrice($this->discount_amount, $this->cart->cart_currency_code), 'additional' => is_array($this->resource->additional) ? $this->resource->additional : json_decode($this->resource->additional, true), diff --git a/packages/Sarga/API/Http/Resources/Checkout/CartResource.php b/packages/Sarga/API/Http/Resources/Checkout/CartResource.php index 1b377fcf5..eab75bcce 100644 --- a/packages/Sarga/API/Http/Resources/Checkout/CartResource.php +++ b/packages/Sarga/API/Http/Resources/Checkout/CartResource.php @@ -30,25 +30,25 @@ class CartResource extends JsonResource 'id' => $this->id, 'shipping_method' => $this->shipping_method, 'shipping_price' => $this->selected_shipping_rate->price ?? 0, - 'formatted_shipping_price' => core()->formatPrice($this->selected_shipping_rate->base_price ?? 0, $this->cart_currency_code), + 'formatted_shipping_price' => core()->formatPrice($this->selected_shipping_rate->price ?? 0, $this->cart_currency_code), 'coupon_code' => $this->coupon_code, 'is_gift' => $this->is_gift, 'items_count' => (int) $this->items_count, 'items_qty' => (int) $this->items_qty, 'grand_total' => (double) $this->grand_total, - 'formatted_grand_total' => core()->formatPrice($this->base_grand_total,$this->cart_currency_code), + 'formatted_grand_total' => core()->formatPrice($this->grand_total,$this->cart_currency_code), 'sub_total' => (double) $this->sub_total, - 'formatted_sub_total' => core()->formatPrice($this->base_sub_total, $this->cart_currency_code), + 'formatted_sub_total' => core()->formatPrice($this->sub_total, $this->cart_currency_code), 'tax_total' => (double) $this->tax_total, - 'formatted_tax_total' => core()->formatPrice($this->base_tax_total, $this->cart_currency_code), + 'formatted_tax_total' => core()->formatPrice($this->tax_total, $this->cart_currency_code), 'discount' => (double) $this->discount_amount, - 'formatted_discount' => core()->formatPrice(abs((double)$this->base_discount_amount), $this->cart_currency_code), + 'formatted_discount' => core()->formatPrice(abs((double)$this->discount_amount), $this->cart_currency_code), 'checkout_method' => $this->checkout_method, 'vendors' => $this->groupByVendors($this->items), 'payment' => new CartPaymentResource($this->payment), 'billing_address' => new AddressResource($this->billing_address), 'shipping_address' => new AddressResource($this->shipping_address), - 'formatted_discounted_sub_total' => core()->formatPrice($this->base_sub_total - $this->base_discount_amount, $this->cart_currency_code), + 'formatted_discounted_sub_total' => core()->formatPrice($this->sub_total - $this->discount_amount, $this->cart_currency_code), 'cart_rules' => $this->cartRules(), ]; } diff --git a/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php b/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php index 54fbccff7..2ceb742e4 100644 --- a/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php +++ b/packages/Sarga/API/Http/Resources/Customer/OrderItemResource.php @@ -31,28 +31,28 @@ class OrderItemResource extends JsonResource 'qty_shipped' => (int) $this->qty_shipped, 'qty_refunded' => (int) $this->qty_refunded, 'price' => (double) $this->price, - 'formatted_price' => core()->formatBasePrice($this->price), + 'formatted_price' => core()->formatPrice($this->price, $this->order->order_currency_code), 'total' => (double) $this->total, - 'formatted_total' => core()->formatBasePrice($this->total), + 'formatted_total' => core()->formatPrice($this->total, $this->order->order_currency_code), 'total_invoiced' => (double) $this->total_invoiced, - 'formatted_total_invoiced' => core()->formatBasePrice($this->total_invoiced, $this->order->order_currency_code), + 'formatted_total_invoiced' => core()->formatPrice($this->total_invoiced, $this->order->order_currency_code), 'amount_refunded' => (double) $this->amount_refunded, - 'formatted_amount_refunded' => core()->formatBasePrice($this->amount_refunded, $this->order->order_currency_code), + 'formatted_amount_refunded' => core()->formatPrice($this->amount_refunded, $this->order->order_currency_code), 'discount_percent' => (double) $this->discount_percent, 'discount_amount' => (double) $this->discount_amount, - 'formatted_discount_amount' => core()->formatBasePrice($this->base_discount_amount, $this->order->order_currency_code), + 'formatted_discount_amount' => core()->formatPrice($this->discount_amount, $this->order->order_currency_code), 'discount_invoiced' => (double) $this->discount_invoiced, - 'formatted_discount_invoiced' => core()->formatBasePrice($this->discount_invoiced, $this->order->order_currency_code), + 'formatted_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order->order_currency_code), 'discount_refunded' => (double) $this->discount_refunded, - 'formatted_discount_refunded' => core()->formatBasePrice($this->discount_refunded, $this->order->order_currency_code), + 'formatted_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order->order_currency_code), 'grant_total' => $this->total + $this->tax_amount, - 'formatted_grant_total' => core()->formatBasePrice($this->total + $this->tax_amount, $this->order->order_currency_code), + 'formatted_grant_total' => core()->formatPrice($this->total + $this->tax_amount, $this->order->order_currency_code), // 'downloadable_links' => $this->downloadable_link_purchased, // 'additional' => is_array($this->resource->additional) // ? $this->resource->additional diff --git a/packages/Sarga/API/Http/Resources/Customer/OrderResource.php b/packages/Sarga/API/Http/Resources/Customer/OrderResource.php index aec0406ac..6d7dcee56 100644 --- a/packages/Sarga/API/Http/Resources/Customer/OrderResource.php +++ b/packages/Sarga/API/Http/Resources/Customer/OrderResource.php @@ -41,40 +41,40 @@ class OrderResource extends JsonResource 'channel_currency_code' => $this->channel_currency_code, 'order_currency_code' => $this->order_currency_code, 'grand_total' => (double) $this->grand_total, - 'formatted_grand_total' => core()->formatPrice($this->base_grand_total, $this->order_currency_code), + 'formatted_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code), 'total_weight' => $this->items->sum('total_weight'), 'grand_total_invoiced' => (double) $this->grand_total_invoiced, - 'formatted_grand_total_invoiced' => core()->formatPrice($this->base_grand_total_invoiced, $this->order_currency_code), + 'formatted_grand_total_invoiced' => core()->formatPrice($this->grand_total_invoiced, $this->order_currency_code), 'grand_total_refunded' => (double) $this->grand_total_refunded, - 'formatted_grand_total_refunded' => core()->formatPrice($this->base_grand_total_refunded, $this->order_currency_code), + 'formatted_grand_total_refunded' => core()->formatPrice($this->grand_total_refunded, $this->order_currency_code), 'sub_total' => (double) $this->sub_total, - 'formatted_sub_total' => core()->formatPrice($this->base_sub_total, $this->order_currency_code), + 'formatted_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code), 'sub_total_invoiced' => (double) $this->sub_total_invoiced, - 'formatted_sub_total_invoiced' => core()->formatPrice($this->base_sub_total_invoiced, $this->order_currency_code), + 'formatted_sub_total_invoiced' => core()->formatPrice($this->sub_total_invoiced, $this->order_currency_code), 'sub_total_refunded' => (double) $this->sub_total_refunded, // 'formatted_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code), 'discount_percent' => (double) $this->discount_percent, 'discount_amount' => (double) $this->discount_amount, - 'formatted_discount_amount' => core()->formatPrice(abs((double)$this->base_discount_amount), $this->order_currency_code), + 'formatted_discount_amount' => core()->formatPrice(abs((double)$this->discount_amount), $this->order_currency_code), 'discount_invoiced' => (double)$this->discount_invoiced, - 'formatted_discount_invoiced' => core()->formatPrice($this->base_discount_invoiced, $this->order_currency_code), + 'formatted_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order_currency_code), 'discount_refunded' => (double) $this->discount_refunded, 'formatted_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order_currency_code), 'shipping_amount' => (double) $this->shipping_amount, - 'formatted_shipping_amount' => core()->formatPrice($this->base_shipping_amount, $this->order_currency_code), + 'formatted_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code), 'shipping_invoiced' => $this->shipping_invoiced, - 'formatted_shipping_invoiced' => core()->formatPrice($this->base_shipping_invoiced, $this->order_currency_code), + 'formatted_shipping_invoiced' => core()->formatPrice($this->shipping_invoiced, $this->order_currency_code), 'shipping_refunded' => $this->shipping_refunded, - 'formatted_shipping_refunded' => core()->formatPrice($this->base_shipping_refunded, $this->order_currency_code), + 'formatted_shipping_refunded' => core()->formatPrice($this->shipping_refunded, $this->order_currency_code), 'shipping_address' => new OrderAddressResource($this->shipping_address), 'billing_address' => new OrderAddressResource($this->billing_address), diff --git a/packages/Webkul/Core/src/Core.php b/packages/Webkul/Core/src/Core.php index 998dafd3b..5dcce3815 100755 --- a/packages/Webkul/Core/src/Core.php +++ b/packages/Webkul/Core/src/Core.php @@ -660,15 +660,15 @@ class Core $formatter = new \NumberFormatter('ru_RU', \NumberFormatter::CURRENCY); - if ($symbol = $currency->symbol) { - if ($this->currencySymbol($currency) == $symbol) { - return $formatter->formatCurrency($price, $currency->code); - } - - $formatter->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol); - - return $formatter->format($this->convertPrice($price)); - } +// if ($symbol = $currency->symbol) { +// if ($this->currencySymbol($currency) == $symbol) { +// return $formatter->formatCurrency($price, $currency->code); +// } +// +// $formatter->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol); +// +// return $formatter->format($this->convertPrice($price)); +// } return $formatter->formatCurrency($price, $currency->code); }