Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Refactor IPriceFormatter
support835b0648f143
diff --git a/src/Business/Grand.Business.Catalog/Services/Prices/PriceFormatter.cs b/src/Business/Grand.Business.Catalog/Services/Prices/PriceFormatter.csindex 7b2beacfd..832521f16 100644--- a/src/Business/Grand.Business.Catalog/Services/Prices/PriceFormatter.cs+++ b/src/Business/Grand.Business.Catalog/Services/Prices/PriceFormatter.cs@@ -1,10 +1,6 @@using Grand.Business.Core.Interfaces.Catalog.Prices;-using Grand.Business.Core.Interfaces.Common.Directory;-using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Domain.Catalog;using Grand.Domain.Directory;-using Grand.Domain.Localization;-using Grand.Domain.Tax;using Grand.Infrastructure;using Grand.SharedKernel;using System.Globalization;@@ -19,23 +15,14 @@ namespace Grand.Business.Catalog.Services.Prices#region Fieldsprivate readonly IWorkContext _workContext;- private readonly ICurrencyService _currencyService;- private readonly ITranslationService _translationService;- private readonly TaxSettings _taxSettings;#endregion#region Constructors- public PriceFormatter(IWorkContext workContext,- ICurrencyService currencyService,- ITranslationService translationService,- TaxSettings taxSettings)+ public PriceFormatter(IWorkContext workContext){_workContext = workContext;- _currencyService = currencyService;- _translationService = translationService;- _taxSettings = taxSettings;}#endregion@@ -56,7 +43,9 @@ namespace Grand.Business.Catalog.Services.Pricesvar result = "";if (!string.IsNullOrEmpty(targetCurrency.CustomFormatting)){- var cultureInfo = !string.IsNullOrEmpty(targetCurrency.DisplayLocale) ? new CultureInfo(targetCurrency.DisplayLocale) : null;+ var cultureInfo = !string.IsNullOrEmpty(targetCurrency.DisplayLocale)+ ? new CultureInfo(targetCurrency.DisplayLocale)+ : null;result = amount.ToString(targetCurrency.CustomFormatting, cultureInfo);}else@@ -95,151 +84,10 @@ namespace Grand.Business.Catalog.Services.Prices/// <param name="price">Price</param>/// <param name="targetCurrency">Target currency</param>/// <returns>Price</returns>- public virtual string FormatPrice(double price, Currency targetCurrency)- {- var priceIncludesTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax;- return FormatPrice(price, targetCurrency, _workContext.WorkingLanguage, priceIncludesTax);- }-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="showTax">Indicates if it should show tax suffix</param>- /// <returns>Price</returns>- public virtual string FormatPrice(double price, bool showTax)- {- var priceIncludesTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax;- return FormatPrice(price, _workContext.WorkingCurrency, _workContext.WorkingLanguage, priceIncludesTax, showTax);- }-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="showTax">A value indicating whether to show tax suffix</param>- /// <param name="language">Language</param>- /// <returns>Price</returns>- public virtual async Task<string> FormatPrice(double price, string currencyCode, bool showTax, Language language)- {- var currency = !string.IsNullOrEmpty(currencyCode) ? await _currencyService.GetCurrencyByCode(currencyCode) : null;- var priceIncludesTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax;- return FormatPrice(price, currency, language, priceIncludesTax, showTax);- }-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- public virtual async Task<string> FormatPrice(double price, string currencyCode, Language language, bool priceIncludesTax)- {- var currency = !string.IsNullOrEmpty(currencyCode) ? await _currencyService.GetCurrencyByCode(currencyCode) : null;- return FormatPrice(price, currency, language, priceIncludesTax);- }-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- public virtual string FormatPrice(double price, Currency targetCurrency, Language language, bool priceIncludesTax)- {- return FormatPrice(price, targetCurrency, language, priceIncludesTax, _taxSettings.DisplayTaxSuffix);- }-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">Indicates if price includes tax</param>- /// <param name="showTax">Indicates if it should show tax suffix</param>- /// <returns>Price</returns>- public string FormatPrice(double price, Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax)+ public string FormatPrice(double price, Currency targetCurrency){var currencyString = GetCurrencyString(price, targetCurrency);- if (!showTax) return currencyString;- //show tax suffix- string formatStr;- if (priceIncludesTax)- {- formatStr = _translationService.GetResource("Products.InclTaxSuffix", language.Id);- if (string.IsNullOrEmpty(formatStr))- formatStr = "{0} incl tax";- }- else- {- formatStr = _translationService.GetResource("Products.ExclTaxSuffix", language.Id);- if (string.IsNullOrEmpty(formatStr))- formatStr = "{0} excl tax";- }- return string.Format(formatStr, currencyString);-- }---- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <returns>Price</returns>- public virtual string FormatShippingPrice(double price)- {- var priceIncludesTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax;- return FormatShippingPrice(price, _workContext.WorkingCurrency, _workContext.WorkingLanguage, priceIncludesTax);- }-- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">Indicates if price includes tax</param>- /// <returns>Price</returns>- public virtual string FormatShippingPrice(double price, Currency targetCurrency, Language language, bool priceIncludesTax)- {- var showTax = _taxSettings.ShippingIsTaxable && _taxSettings.DisplayTaxSuffix;- return FormatShippingPrice(price, targetCurrency, language, priceIncludesTax, showTax);- }-- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">Indicates if price includes tax</param>- /// <param name="showTax">Indicates if it should show a tax suffix</param>- /// <returns>Price</returns>- public virtual string FormatShippingPrice(double price,- Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax)- {- return FormatPrice(price, targetCurrency, language, priceIncludesTax, showTax);- }-- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">Indicates if price includes tax</param>- /// <returns>Price</returns>- public virtual async Task<string> FormatShippingPrice(double price, string currencyCode, Language language, bool priceIncludesTax)- {- var currency = !string.IsNullOrEmpty(currencyCode) ? await _currencyService.GetCurrencyByCode(currencyCode) : null;- return FormatShippingPrice(price, currency, language, priceIncludesTax);+ return currencyString;}/// <summary>@@ -265,65 +113,6 @@ namespace Grand.Business.Catalog.Services.Pricesreturn result;}-- /// <summary>- /// Payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <returns>Price</returns>- public virtual string FormatPaymentMethodAdditionalFee(double price)- {- var priceIncludesTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax;- return FormatPaymentMethodAdditionalFee(price, _workContext.WorkingCurrency,- _workContext.WorkingLanguage, priceIncludesTax);- }-- /// <summary>- /// Formats the payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">Indicates if price includes tax</param>- /// <returns>Price</returns>- public virtual string FormatPaymentMethodAdditionalFee(double price,- Currency targetCurrency, Language language, bool priceIncludesTax)- {- var showTax = _taxSettings.PaymentMethodAdditionalFeeIsTaxable && _taxSettings.DisplayTaxSuffix;- return FormatPaymentMethodAdditionalFee(price, targetCurrency, language, priceIncludesTax, showTax);- }-- /// <summary>- /// Formats the payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">Indicates if price includes tax</param>- /// <param name="showTax">Indicates if it should show a tax suffix</param>- /// <returns>Price</returns>- public virtual string FormatPaymentMethodAdditionalFee(double price,- Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax)- {- return FormatPrice(price, targetCurrency, language, priceIncludesTax, showTax);- }-- /// <summary>- /// Formats the payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">Indicates if price includes tax</param>- /// <returns>Price</returns>- public virtual async Task<string> FormatPaymentMethodAdditionalFee(double price,- string currencyCode, Language language, bool priceIncludesTax)- {- var currency = !string.IsNullOrEmpty(currencyCode) ? await _currencyService.GetCurrencyByCode(currencyCode) : null;- return FormatPaymentMethodAdditionalFee(price, currency,- language, priceIncludesTax);- }-/// <summary>/// Formats a tax rate/// </summary>@@ -336,4 +125,4 @@ namespace Grand.Business.Catalog.Services.Prices#endregion}-}+}\ No newline at end of filediff --git a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.csindex 538421149..aec76fc07 100644--- a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs+++ b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs@@ -237,13 +237,13 @@ namespace Grand.Business.Catalog.Services.Products{case > 0:{- var priceAdjustmentStr = _priceFormatter.FormatPrice(priceAdjustmentBase, false);+ var priceAdjustmentStr = _priceFormatter.FormatPrice(priceAdjustmentBase, _workContext.WorkingCurrency);formattedAttribute += $" [+{priceAdjustmentStr}]";break;}case < 0:{- var priceAdjustmentStr = _priceFormatter.FormatPrice(-priceAdjustmentBase, false);+ var priceAdjustmentStr = _priceFormatter.FormatPrice(-priceAdjustmentBase, _workContext.WorkingCurrency);formattedAttribute += $" [-{priceAdjustmentStr}]";break;}diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.csindex 2c4b1dbdc..2b3348a76 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs@@ -486,7 +486,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersif (!minOrderSubtotalAmountOk){var minOrderSubtotalAmount = await _currencyService.ConvertFromPrimaryStoreCurrency(_orderSettings.MinOrderSubtotalAmount, _workContext.WorkingCurrency);- throw new GrandException(string.Format(_translationService.GetResource("Checkout.MinOrderSubtotalAmount"), _priceFormatter.FormatPrice(minOrderSubtotalAmount, false)));+ throw new GrandException(string.Format(_translationService.GetResource("Checkout.MinOrderSubtotalAmount"), _priceFormatter.FormatPrice(minOrderSubtotalAmount, _workContext.WorkingCurrency)));}var minmaxOrderTotalAmountOk = await _mediator.Send(new ValidateShoppingCartTotalAmountCommand() { Customer = details.Customer, Cart = details.Cart });diff --git a/src/Business/Grand.Business.Core/Interfaces/Catalog/Prices/IPriceFormatter.cs b/src/Business/Grand.Business.Core/Interfaces/Catalog/Prices/IPriceFormatter.csindex 3010410ff..f334d0b24 100644--- a/src/Business/Grand.Business.Core/Interfaces/Catalog/Prices/IPriceFormatter.cs+++ b/src/Business/Grand.Business.Core/Interfaces/Catalog/Prices/IPriceFormatter.cs@@ -1,6 +1,5 @@using Grand.Domain.Catalog;using Grand.Domain.Directory;-using Grand.Domain.Localization;namespace Grand.Business.Core.Interfaces.Catalog.Prices{@@ -20,56 +19,7 @@ namespace Grand.Business.Core.Interfaces.Catalog.Prices/// <param name="targetCurrency">Target currency</param>/// <returns>Price</returns>string FormatPrice(double price, Currency targetCurrency);-- /// <summary>- /// Formats price- /// </summary>- /// <param name="price">Price</param>- /// <param name="showTax">A value that indicates if it should shows tax suffix</param>- /// <returns>Price</returns>- string FormatPrice(double price, bool showTax);-- /// <summary>- /// Formats price- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="showTax">A value that indicates if it should shows a tax suffix</param>- /// <param name="language">Language</param>- /// <returns>Price</returns>- Task<string> FormatPrice(double price, string currencyCode, bool showTax, Language language);-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- Task<string> FormatPrice(double price, string currencyCode, Language language, bool priceIncludesTax);-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- string FormatPrice(double price, Currency targetCurrency, Language language, bool priceIncludesTax);-- /// <summary>- /// Formats the price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <param name="showTax">A value indicating whether to show tax suffix</param>- /// <returns>Price</returns>- string FormatPrice(double price, Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax);-+/// <summary>/// Resource name of rental product (rental period)/// </summary>@@ -77,81 +27,6 @@ namespace Grand.Business.Core.Interfaces.Catalog.Prices/// <returns>Rental product price with period</returns>string ResourceReservationProductPeriod(Product product);- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <returns>Price</returns>- string FormatShippingPrice(double price);-- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- string FormatShippingPrice(double price, Currency targetCurrency, Language language, bool priceIncludesTax);-- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <param name="showTax">A value indicating whether to show tax suffix</param>- /// <returns>Price</returns>- string FormatShippingPrice(double price, Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax);-- /// <summary>- /// Formats the shipping price- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- Task<string> FormatShippingPrice(double price, string currencyCode, Language language, bool priceIncludesTax);-- /// <summary>- /// Formats the payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <returns>Price</returns>- string FormatPaymentMethodAdditionalFee(double price);-- /// <summary>- /// Formats the payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- string FormatPaymentMethodAdditionalFee(double price, Currency targetCurrency, Language language, bool priceIncludesTax);-- /// <summary>- /// Formats the payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <param name="targetCurrency">Target currency</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <param name="showTax">A value indicating whether to show tax suffix</param>- /// <returns>Price</returns>- string FormatPaymentMethodAdditionalFee(double price, Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax);-- /// <summary>- /// Formats the payment method additional fee- /// </summary>- /// <param name="price">Price</param>- /// <param name="currencyCode">Currency code</param>- /// <param name="language">Language</param>- /// <param name="priceIncludesTax">A value indicating whether price includes tax</param>- /// <returns>Price</returns>- Task<string> FormatPaymentMethodAdditionalFee(double price, string currencyCode, Language language, bool priceIncludesTax);/// <summary>/// Formats a tax ratediff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.csindex 38c07dde6..cefffac31 100644--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.cs+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.cs@@ -35,8 +35,10 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops}public string UnitPrice { get; set; }+ public bool UnitPriceWithTax { get; set; }public string TotalPrice { get; set; }+ public bool TotalPriceWithTax { get; set; }public string ProductSku { get; set; }diff --git a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetGiftVoucherTokensCommandHandler.cs b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetGiftVoucherTokensCommandHandler.csindex 6a74a9dbc..420da7317 100644--- a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetGiftVoucherTokensCommandHandler.cs+++ b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetGiftVoucherTokensCommandHandler.cs@@ -1,5 +1,6 @@using Grand.Business.Core.Interfaces.Catalog.Prices;using Grand.Business.Core.Commands.Messages.Tokens;+using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Business.Core.Utilities.Messages.DotLiquidDrops;using MediatR;@@ -8,17 +9,18 @@ namespace Grand.Business.System.Commands.Handlers.Messagespublic class GetGiftVoucherTokensCommandHandler : IRequestHandler<GetGiftVoucherTokensCommand, LiquidGiftVoucher>{private readonly IPriceFormatter _priceFormatter;-- public GetGiftVoucherTokensCommandHandler(IPriceFormatter priceFormatter)+ private readonly ICurrencyService _currencyService;+ public GetGiftVoucherTokensCommandHandler(IPriceFormatter priceFormatter, ICurrencyService currencyService){_priceFormatter = priceFormatter;+ _currencyService = currencyService;}public async Task<LiquidGiftVoucher> Handle(GetGiftVoucherTokensCommand request, CancellationToken cancellationToken){var liquidGiftCart = new LiquidGiftVoucher(request.GiftVoucher){- Amount = await _priceFormatter.FormatPrice(request.GiftVoucher.Amount, request.GiftVoucher.CurrencyCode, false, request.Language)+ Amount = _priceFormatter.FormatPrice(request.GiftVoucher.Amount, await _currencyService.GetCurrencyByCode(request.GiftVoucher.CurrencyCode))};return await Task.FromResult(liquidGiftCart);}diff --git a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.csindex cde56d4ed..3957b303b 100644--- a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs+++ b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs@@ -80,25 +80,17 @@ namespace Grand.Business.System.Commands.Handlers.Messages#endregion#region Unit price-- var unitPriceStr =- //including tax- request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax ? _priceFormatter.FormatPrice(item.UnitPriceInclTax, currency, language, true) :- //excluding tax- _priceFormatter.FormatPrice(item.UnitPriceExclTax, currency, language, false);- liquidItem.UnitPrice = unitPriceStr;-++ liquidItem.UnitPrice = _priceFormatter.FormatPrice(item.UnitPriceInclTax, currency);+ liquidItem.UnitPriceWithTax = request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax;+#endregion#region total price-- var priceStr =- //including tax- request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax ? _priceFormatter.FormatPrice(item.PriceInclTax, currency, language, true) :- //excluding tax- _priceFormatter.FormatPrice(item.PriceExclTax, currency, language, false);- liquidItem.TotalPrice = priceStr;-++ liquidItem.TotalPrice = _priceFormatter.FormatPrice(item.PriceInclTax, currency);+ liquidItem.TotalPriceWithTax = request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax;+#endregionvar sku = "";@@ -125,13 +117,12 @@ namespace Grand.Business.System.Commands.Handlers.Messagesforeach (var item in request.Order.OrderTaxes){var taxRate = string.Format(_translationService.GetResource("Messages.Order.TaxRateLine", language.Id), _priceFormatter.FormatTaxRate(item.Percent));- var taxValue = _priceFormatter.FormatPrice(item.Amount, currency, language, false);+ var taxValue = _priceFormatter.FormatPrice(item.Amount);if (string.IsNullOrEmpty(taxRate))taxRate = item.Percent.ToString(CultureInfo.InvariantCulture);- if (!dict.ContainsKey(taxRate))- dict.Add(taxRate, taxValue);+ dict.TryAdd(taxRate, taxValue);}liquidOrder.TaxRates = dict;@@ -142,14 +133,14 @@ namespace Grand.Business.System.Commands.Handlers.Messages{var giftVoucher = await _giftVoucherService.GetGiftVoucherById(gcuh.GiftVoucherId);var giftVoucherText = string.Format(_translationService.GetResource("Messages.Order.GiftVoucherInfo", language.Id), WebUtility.HtmlEncode(giftVoucher.Code));- var giftVoucherAmount = _priceFormatter.FormatPrice(-gcuh.UsedValue, currency, language, true, false);+ var giftVoucherAmount = _priceFormatter.FormatPrice(-gcuh.UsedValue, currency);cards.Add(giftVoucherText, giftVoucherAmount);}liquidOrder.GiftVouchers = cards;if (request.Order.RedeemedLoyaltyPoints > 0){liquidOrder.RPTitle = string.Format(_translationService.GetResource("Messages.Order.LoyaltyPoints", language.Id), -request.Order.RedeemedLoyaltyPoints);- liquidOrder.RPAmount = _priceFormatter.FormatPrice(-request.Order.RedeemedLoyaltyPointsAmount, currency, language, true, false);+ liquidOrder.RPAmount = _priceFormatter.FormatPrice(-request.Order.RedeemedLoyaltyPointsAmount, currency);}void CalculateSubTotals(){@@ -169,25 +160,23 @@ namespace Grand.Business.System.Commands.Handlers.Messages_cusSubTotalDiscount = string.Empty;if (request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal){- //including tax-//subtotal- _cusSubTotal = _priceFormatter.FormatPrice(request.Order.OrderSubtotalInclTax, currency, language, true);+ _cusSubTotal = _priceFormatter.FormatPrice(request.Order.OrderSubtotalInclTax, currency);//discount (applied to order subtotal)if (request.Order.OrderSubTotalDiscountInclTax > 0){- _cusSubTotalDiscount = _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountInclTax, currency, language, true);+ _cusSubTotalDiscount = _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountInclTax, currency);_displaySubTotalDiscount = true;}}else{//subtotal- _cusSubTotal = _priceFormatter.FormatPrice(request.Order.OrderSubtotalExclTax, currency, language, false);+ _cusSubTotal = _priceFormatter.FormatPrice(request.Order.OrderSubtotalExclTax, currency);//discount (applied to order subtotal)if (request.Order.OrderSubTotalDiscountExclTax > 0){- _cusSubTotalDiscount = _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountExclTax, currency, language, false);+ _cusSubTotalDiscount = _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountExclTax, currency);_displaySubTotalDiscount = true;}}@@ -198,21 +187,17 @@ namespace Grand.Business.System.Commands.Handlers.Messagesif (request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax){- //including tax-//shipping- _cusShipTotal = _priceFormatter.FormatShippingPrice(request.Order.OrderShippingInclTax, currency, language, true);+ _cusShipTotal = _priceFormatter.FormatPrice(request.Order.OrderShippingInclTax, currency);//payment method additional fee- _cusPaymentMethodAdditionalFee = _priceFormatter.FormatPaymentMethodAdditionalFee(request.Order.PaymentMethodAdditionalFeeInclTax, currency, language, true);+ _cusPaymentMethodAdditionalFee = _priceFormatter.FormatPrice(request.Order.PaymentMethodAdditionalFeeInclTax, currency);}else{- //excluding tax-//shipping- _cusShipTotal = _priceFormatter.FormatShippingPrice(request.Order.OrderShippingExclTax, currency, language, false);+ _cusShipTotal = _priceFormatter.FormatPrice(request.Order.OrderShippingExclTax, currency);//payment method additional fee- _cusPaymentMethodAdditionalFee = _priceFormatter.FormatPaymentMethodAdditionalFee(request.Order.PaymentMethodAdditionalFeeExclTax, currency, language, false);+ _cusPaymentMethodAdditionalFee = _priceFormatter.FormatPrice(request.Order.PaymentMethodAdditionalFeeExclTax, currency);}if (_taxSettings.HideTaxInOrderSummary && request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax){@@ -231,7 +216,7 @@ namespace Grand.Business.System.Commands.Handlers.Messages_displayTaxRates = _taxSettings.DisplayTaxRates && request.Order.OrderTaxes.Any();_displayTax = !_displayTaxRates;- var taxStr = _priceFormatter.FormatPrice(request.Order.OrderTax, currency, language, request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax, false);+ var taxStr = _priceFormatter.FormatPrice(request.Order.OrderTax, currency);_cusTaxTotal = taxStr;}}@@ -240,13 +225,12 @@ namespace Grand.Business.System.Commands.Handlers.Messages_displayDiscount = false;if (request.Order.OrderDiscount > 0){- _cusDiscount = _priceFormatter.FormatPrice(-request.Order.OrderDiscount, currency, language, request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax, false);+ _cusDiscount = _priceFormatter.FormatPrice(-request.Order.OrderDiscount, currency);_displayDiscount = true;}//total- _cusTotal = _priceFormatter.FormatPrice(request.Order.OrderTotal, currency, language, request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax, false);-+ _cusTotal = _priceFormatter.FormatPrice(request.Order.OrderTotal, currency);liquidOrder.SubTotal = _cusSubTotal;liquidOrder.DisplaySubTotalDiscount = _displaySubTotalDiscount;diff --git a/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs b/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.csindex f4300ce7b..2a8069b5d 100644--- a/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs+++ b/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs@@ -38,7 +38,7 @@ namespace Shipping.ShippingPoint.Controllersvar shippingPoint = await _shippingPointService.GetStoreShippingPointById(shippingOptionId);if (shippingPoint == null) return Content("ShippingPointController: given Shipping Option doesn't exist");var rateBase = await _currencyService.ConvertFromPrimaryStoreCurrency(shippingPoint.PickupFee, _workContext.WorkingCurrency);- var fee = _priceFormatter.FormatShippingPrice(rateBase);+ var fee = _priceFormatter.FormatPrice(rateBase, _workContext.WorkingCurrency);var viewModel = new PointModel {ShippingPointName = shippingPoint.ShippingPointName,diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceFormatterTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceFormatterTests.csindex 0ea99ed26..2b1cc5d56 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceFormatterTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceFormatterTests.cs@@ -102,7 +102,7 @@ namespace Grand.Business.Catalog.Tests.Services.Prices_translationService = tempLocalizationService.Object;}- _priceFormatter = new PriceFormatter(_workContext, _currencyService, _translationService, _taxSettings);+ _priceFormatter = new PriceFormatter(_workContext);}[TestMethod()]@@ -130,7 +130,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesLanguageCulture = "en-US"};- Assert.AreEqual("€412.20", _priceFormatter.FormatPrice(412.2, currency0111, language0111, false, false));+ Assert.AreEqual("€412.20", _priceFormatter.FormatPrice(412.2, currency0111));}[TestMethod()]@@ -164,36 +164,8 @@ namespace Grand.Business.Catalog.Tests.Services.PricesName = "English",LanguageCulture = "en-US"};- Assert.AreEqual("$1,234.50", _priceFormatter.FormatPrice(1234.5, usd_currency, language, false, false));- Assert.AreEqual("£1,234.50", _priceFormatter.FormatPrice(1234.5, gbp_currency, language, false, false));- }-- [TestMethod()]- public void Can_formatPrice_with_showTax()- {- //$18,888.10 priceIncludestax=false || showTax=false- //$18,888.10 incl tax priceIncludestax=true || showTax=true- //$18,888.10 excl tax priceIncludestax=false || showTax=true-- var currency = new Currency {- Id = "1",- Name = "US Dollar",- CurrencyCode = "USD",- DisplayLocale = "en-US",- MidpointRoundId = MidpointRounding.AwayFromZero- };- var language = new Language {- Id = "1",- Name = "English",- LanguageCulture = "en-US"- };-- //- Assert.AreEqual("$18,888.10", _priceFormatter.FormatPrice(18888.1, currency, language, false, false));- //- Assert.AreEqual("$18,888.10 incl tax", _priceFormatter.FormatPrice(18888.1, currency, language, true, true));- //- Assert.AreEqual("$18,888.10 excl tax", _priceFormatter.FormatPrice(18888.1, currency, language, false, true));+ Assert.AreEqual("$1,234.50", _priceFormatter.FormatPrice(1234.5, usd_currency));+ Assert.AreEqual("£1,234.50", _priceFormatter.FormatPrice(1234.5, gbp_currency));}[TestMethod()]@@ -214,7 +186,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesLanguageCulture = "en-US"};- Assert.AreEqual("$18,888.10", _priceFormatter.FormatPrice(18888.1, currency, language, false, false));+ Assert.AreEqual("$18,888.10", _priceFormatter.FormatPrice(18888.1, currency));}}diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtmlindex be22d70ce..6e3d99112 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml@@ -1,4 +1,5 @@-@model DashboardModel+@using Grand.Business.Core.Interfaces.Common.Directory+@model DashboardModel@inject Grand.Domain.Customers.CustomerSettings customerSettings@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService@@ -6,7 +7,8 @@@inject Grand.Business.Core.Interfaces.System.Reports.IOrderReportService orderReportService@inject Grand.Business.Core.Interfaces.Catalog.Prices.IPriceFormatter priceFormatter@inject IWorkContext workContext-@inject Grand.Business.Core.Interfaces.Common.Directory.IGroupService groupService+@inject ICurrencyService currencyService+@inject IGroupService groupService@{//page titleViewBag.Title = Loc["Admin.Dashboard"];@@ -16,7 +18,7 @@var customersOnline = (await customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-customerSettings.OnlineCustomerMinutes), null, workContext.CurrentCustomer.StaffStoreId, workContext.CurrentCustomer.SeId, 1, 1)).TotalCount;var customersShoppingCart = await customerService.GetCountOnlineShoppingCart(DateTime.UtcNow.AddMinutes(-customerSettings.OnlineShoppingCartMinutes), workContext.CurrentCustomer.StaffStoreId, workContext.CurrentCustomer.SeId);var ordersToday = await orderReportService.GetOrderPeriodReport(0, workContext.CurrentCustomer.StaffStoreId, workContext.CurrentCustomer.SeId);- var ordersAmount = priceFormatter.FormatPrice(ordersToday.Amount, false);+ var ordersAmount = priceFormatter.FormatPrice(ordersToday.Amount, await currencyService.GetPrimaryStoreCurrency());}<vc:admin-widget widget-zone="admin_dashboard_top" additional-data="null"/>diff --git a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs b/src/Web/Grand.Web.Admin/Controllers/ReportsController.csindex 702efaf50..d09fded93 100644--- a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs@@ -51,7 +51,7 @@ namespace Grand.Web.Admin.Controllersprivate readonly ISearchTermService _searchTermService;private readonly IGroupService _groupService;private readonly IOrderStatusService _orderStatusService;-+ private readonly ICurrencyService _currencyService;public ReportsController(IOrderService orderService,IOrderReportService orderReportService,IProductsReportService productsReportService,@@ -70,7 +70,8 @@ namespace Grand.Web.Admin.ControllersIDateTimeService dateTimeService,ISearchTermService searchTermService,IGroupService groupService,- IOrderStatusService orderStatusService)+ IOrderStatusService orderStatusService,+ ICurrencyService currencyService){_orderService = orderService;_orderReportService = orderReportService;@@ -91,6 +92,7 @@ namespace Grand.Web.Admin.Controllers_searchTermService = searchTermService;_groupService = groupService;_orderStatusService = orderStatusService;+ _currencyService = currencyService;}[NonAction]@@ -118,7 +120,7 @@ namespace Grand.Web.Admin.Controllers{var m = new BestsellersReportLineModel {ProductId = x.ProductId,- TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, false),+ TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),TotalQuantity = x.TotalQuantity};var product = await _productService.GetProductById(x.ProductId);@@ -274,7 +276,7 @@ namespace Grand.Web.Admin.Controllers{var m = new BestsellersReportLineModel {ProductId = x.ProductId,- TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, false),+ TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),TotalQuantity = x.TotalQuantity};var product = await _productService.GetProductById(x.ProductId);@@ -390,16 +392,18 @@ namespace Grand.Web.Admin.Controllers};var statuses = await _orderStatusService.GetAll();-- var model = report.Select(x => new OrderAverageReportLineSummaryModel {- OrderStatus = statuses.FirstOrDefault(y => y.StatusId == x.OrderStatus)?.Name,- SumTodayOrders = _priceFormatter.FormatPrice(x.SumTodayOrders, false),- SumThisWeekOrders = _priceFormatter.FormatPrice(x.SumThisWeekOrders, false),- SumThisMonthOrders = _priceFormatter.FormatPrice(x.SumThisMonthOrders, false),- SumThisYearOrders = _priceFormatter.FormatPrice(x.SumThisYearOrders, false),- SumAllTimeOrders = _priceFormatter.FormatPrice(x.SumAllTimeOrders, false)- }).ToList();-+ var model = new List<OrderAverageReportLineSummaryModel>();+ foreach (var x in report.ToList())+ {+ model.Add(new OrderAverageReportLineSummaryModel {+ OrderStatus = statuses.FirstOrDefault(y => y.StatusId == x.OrderStatus)?.Name,+ SumTodayOrders = _priceFormatter.FormatPrice(x.SumTodayOrders, await _currencyService.GetPrimaryStoreCurrency()),+ SumThisWeekOrders = _priceFormatter.FormatPrice(x.SumThisWeekOrders, await _currencyService.GetPrimaryStoreCurrency()),+ SumThisMonthOrders = _priceFormatter.FormatPrice(x.SumThisMonthOrders, await _currencyService.GetPrimaryStoreCurrency()),+ SumThisYearOrders = _priceFormatter.FormatPrice(x.SumThisYearOrders, await _currencyService.GetPrimaryStoreCurrency()),+ SumAllTimeOrders = _priceFormatter.FormatPrice(x.SumAllTimeOrders, await _currencyService.GetPrimaryStoreCurrency())+ });+ }var gridModel = new DataSourceResult {Data = model,Total = model.Count@@ -440,7 +444,7 @@ namespace Grand.Web.Admin.ControllersId = x.Id,OrderNumber = x.OrderNumber,StoreName = store != null ? store.Shortcut : "Unknown",- OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, false),+ OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, await _currencyService.GetPrimaryStoreCurrency()),OrderStatus = statuses.FirstOrDefault(y => y.StatusId == x.OrderStatusId)?.Name,PaymentStatus = x.PaymentStatusId.GetTranslationEnum(_translationService, _workContext),ShippingStatus = x.ShippingStatusId.GetTranslationEnum(_translationService, _workContext),@@ -477,7 +481,7 @@ namespace Grand.Web.Admin.Controllersmodel.Add(new OrderIncompleteReportLineModel {Item = _translationService.GetResource("Admin.Reports.Incomplete.TotalUnpaidOrders"),Count = psPending.CountOrders,- Total = _priceFormatter.FormatPrice(psPending.SumOrders, false),+ Total = _priceFormatter.FormatPrice(psPending.SumOrders, await _currencyService.GetPrimaryStoreCurrency()),ViewLink = Url.Action("List", "Order", new { paymentStatusId = ((int)PaymentStatus.Pending).ToString(), area = Constants.AreaAdmin })});//not shipped@@ -485,7 +489,7 @@ namespace Grand.Web.Admin.Controllersmodel.Add(new OrderIncompleteReportLineModel {Item = _translationService.GetResource("Admin.Reports.Incomplete.TotalNotShippedOrders"),Count = ssPending.CountOrders,- Total = _priceFormatter.FormatPrice(ssPending.SumOrders, false),+ Total = _priceFormatter.FormatPrice(ssPending.SumOrders, await _currencyService.GetPrimaryStoreCurrency()),ViewLink = Url.Action("List", "Order", new { shippingStatusId = ((int)ShippingStatus.Pending).ToString(), area = Constants.AreaAdmin })});//pending@@ -493,7 +497,7 @@ namespace Grand.Web.Admin.Controllersmodel.Add(new OrderIncompleteReportLineModel {Item = _translationService.GetResource("Admin.Reports.Incomplete.TotalIncompleteOrders"),Count = osPending.CountOrders,- Total = _priceFormatter.FormatPrice(osPending.SumOrders, false),+ Total = _priceFormatter.FormatPrice(osPending.SumOrders, await _currencyService.GetPrimaryStoreCurrency()),ViewLink = Url.Action("List", "Order", new { orderStatusId = ((int)OrderStatusSystem.Pending).ToString(), area = Constants.AreaAdmin })});@@ -553,7 +557,7 @@ namespace Grand.Web.Admin.Controllersvar country = await _countryService.GetCountryById(!string.IsNullOrEmpty(x.CountryId) ? x.CountryId : "");var m = new CountryReportLineModel {CountryName = country != null ? country.Name : "Unknown",- SumOrders = _priceFormatter.FormatPrice(x.SumOrders, false),+ SumOrders = _priceFormatter.FormatPrice(x.SumOrders, await _currencyService.GetPrimaryStoreCurrency()),TotalOrders = x.TotalOrders};result.Add(m);diff --git a/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.cs b/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.csindex ca2486429..c3839aece 100644--- a/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.cs+++ b/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.cs@@ -28,13 +28,14 @@ namespace Grand.Web.Admin.Servicesprivate readonly ITranslationService _translationService;private readonly IDateTimeService _dateTimeService;private readonly IOrderStatusService _orderStatusService;+ private readonly ICurrencyService _currencyService;private readonly SeoSettings _seoSettings;public AffiliateViewModelService(IWorkContext workContext, ICountryService countryService,IPriceFormatter priceFormatter, IAffiliateService affiliateService,ICustomerService customerService, IOrderService orderService, ITranslationService translationService, IDateTimeService dateTimeService,IOrderStatusService orderStatusService,- SeoSettings seoSettings)+ SeoSettings seoSettings, ICurrencyService currencyService){_workContext = workContext;_countryService = countryService;@@ -46,6 +47,7 @@ namespace Grand.Web.Admin.Services_dateTimeService = dateTimeService;_orderStatusService = orderStatusService;_seoSettings = seoSettings;+ _currencyService = currencyService;}public virtual async Task PrepareAffiliateModel(AffiliateModel model, Affiliate affiliate, bool excludeProperties,@@ -185,7 +187,7 @@ namespace Grand.Web.Admin.ServicesOrderStatus = statuses.FirstOrDefault(y => y.StatusId == order.OrderStatusId)?.Name,PaymentStatus = order.PaymentStatusId.GetTranslationEnum(_translationService, _workContext),ShippingStatus = order.ShippingStatusId.GetTranslationEnum(_translationService, _workContext),- OrderTotal = await _priceFormatter.FormatPrice(order.OrderTotal, order.CustomerCurrencyCode, false, _workContext.WorkingLanguage),+ OrderTotal = _priceFormatter.FormatPrice(order.OrderTotal, await _currencyService.GetCurrencyByCode(order.CustomerCurrencyCode)),CreatedOn = _dateTimeService.ConvertToUserTime(order.CreatedOnUtc, DateTimeKind.Utc)};affiliateorders.Add(orderModel);diff --git a/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.csindex 4be712bf2..38c97be76 100644--- a/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs+++ b/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs@@ -23,12 +23,12 @@ namespace Grand.Web.Admin.Servicesprivate readonly IDateTimeService _dateTimeService;private readonly IPriceFormatter _priceFormatter;private readonly IOrderStatusService _orderStatusService;-+ private readonly ICurrencyService _currencyService;public CustomerReportViewModelService(IWorkContext workContext,ICustomerService customerService,ITranslationService translationService, ICustomerReportService customerReportService,IDateTimeService dateTimeService, IPriceFormatter priceFormatter,- IOrderStatusService orderStatusService)+ IOrderStatusService orderStatusService, ICurrencyService currencyService){_workContext = workContext;_customerService = customerService;@@ -37,6 +37,7 @@ namespace Grand.Web.Admin.Services_dateTimeService = dateTimeService;_priceFormatter = priceFormatter;_orderStatusService = orderStatusService;+ _currencyService = currencyService;}public virtual async Task<CustomerReportsModel> PrepareCustomerReportsModel()@@ -118,7 +119,7 @@ namespace Grand.Web.Admin.Services{var m = new BestCustomerReportLineModel {CustomerId = x.CustomerId,- OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, false),+ OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, await _currencyService.GetPrimaryStoreCurrency()),OrderCount = x.OrderCount};var customer = await _customerService.GetCustomerById(x.CustomerId);diff --git a/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.cs b/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.csindex 92283b23e..99f338e90 100644--- a/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.cs+++ b/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.cs@@ -454,7 +454,7 @@ namespace Grand.Web.Admin.ServicesOrderId = x.OrderId,OrderNumber = order?.OrderNumber ?? 0,OrderCode = order != null ? order.Code : "",- OrderTotal = order != null ? _priceFormatter.FormatPrice(order.OrderTotal, false) : "",+ OrderTotal = order != null ? _priceFormatter.FormatPrice(order.OrderTotal, await _currencyService.GetPrimaryStoreCurrency()) : "",CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)};items.Add(duhModel);diff --git a/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.cs b/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.csindex 70a0020b4..94afb663f 100644--- a/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.cs+++ b/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.cs@@ -127,10 +127,8 @@ namespace Grand.Web.Admin.Servicesvar currency = await _currencyService.GetCurrencyByCode(item.CurrencyCode) ??await _currencyService.GetPrimaryStoreCurrency();- gift.RemainingAmountStr = _priceFormatter.FormatPrice(item.GetGiftVoucherRemainingAmount(), currency,- _workContext.WorkingLanguage, true, false);- gift.AmountStr =- _priceFormatter.FormatPrice(item.Amount, currency, _workContext.WorkingLanguage, true, false);+ gift.RemainingAmountStr = _priceFormatter.FormatPrice(item.GetGiftVoucherRemainingAmount(), currency);+ gift.AmountStr = _priceFormatter.FormatPrice(item.Amount, currency);gift.CreatedOn = _dateTimeService.ConvertToUserTime(item.CreatedOnUtc, DateTimeKind.Utc);giftvouchers.Add(gift);@@ -167,10 +165,8 @@ namespace Grand.Web.Admin.Servicesawait _currencyService.GetPrimaryStoreCurrency();model.PurchasedWithOrderId = giftVoucher.PurchasedWithOrderItem != null ? (await GetOrderFromGiftVoucher(giftVoucher))?.Id : null;- model.RemainingAmountStr = _priceFormatter.FormatPrice(giftVoucher.GetGiftVoucherRemainingAmount(),- currency, _workContext.WorkingLanguage, true, false);- model.AmountStr = _priceFormatter.FormatPrice(giftVoucher.Amount, currency, _workContext.WorkingLanguage,- true, false);+ model.RemainingAmountStr = _priceFormatter.FormatPrice(giftVoucher.GetGiftVoucherRemainingAmount(), currency);+ model.AmountStr = _priceFormatter.FormatPrice(giftVoucher.Amount, currency);model.CreatedOn = _dateTimeService.ConvertToUserTime(giftVoucher.CreatedOnUtc, DateTimeKind.Utc);model.CurrencyCode = giftVoucher.CurrencyCode;return model;@@ -234,10 +230,8 @@ namespace Grand.Web.Admin.Servicesmodel.PurchasedWithOrderId = giftVoucher.PurchasedWithOrderItem != null ? order?.Id : null;model.PurchasedWithOrderNumber = order?.OrderNumber ?? 0;- model.RemainingAmountStr = _priceFormatter.FormatPrice(giftVoucher.GetGiftVoucherRemainingAmount(),- currency, _workContext.WorkingLanguage, true, false);- model.AmountStr = _priceFormatter.FormatPrice(giftVoucher.Amount, currency, _workContext.WorkingLanguage,- true, false);+ model.RemainingAmountStr = _priceFormatter.FormatPrice(giftVoucher.GetGiftVoucherRemainingAmount(), currency);+ model.AmountStr = _priceFormatter.FormatPrice(giftVoucher.Amount, currency);model.CreatedOn = _dateTimeService.ConvertToUserTime(giftVoucher.CreatedOnUtc, DateTimeKind.Utc);model.CurrencyCode = giftVoucher.CurrencyCode;return model;@@ -258,8 +252,7 @@ namespace Grand.Web.Admin.ServicesId = x.Id,OrderId = x.UsedWithOrderId,OrderNumber = order?.OrderNumber ?? 0,- UsedValue = _priceFormatter.FormatPrice(x.UsedValue, currency, _workContext.WorkingLanguage, true,- false),+ UsedValue = _priceFormatter.FormatPrice(x.UsedValue, currency),CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)});}diff --git a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.csindex 3fd25ae68..fc1cea576 100644--- a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs+++ b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs@@ -342,8 +342,8 @@ namespace Grand.Web.Admin.Servicesforeach (var x in orders){var store = await _storeService.GetStoreById(x.StoreId);- var orderTotal = await _priceFormatter.FormatPrice(x.OrderTotal, x.CustomerCurrencyCode, false,- _workContext.WorkingLanguage);+ var orderTotal = _priceFormatter.FormatPrice(x.OrderTotal,+ await _currencyService.GetCurrencyByCode(x.CustomerCurrencyCode));items.Add(new OrderModel {Id = x.Id,OrderNumber = x.OrderNumber,@@ -453,17 +453,15 @@ namespace Grand.Web.Admin.Servicesthrow new Exception("Cannot load order currency");//subtotal- model.OrderSubtotalInclTax = _priceFormatter.FormatPrice(order.OrderSubtotalInclTax, orderCurrency,- _workContext.WorkingLanguage, true);- model.OrderSubtotalExclTax = _priceFormatter.FormatPrice(order.OrderSubtotalExclTax, orderCurrency,- _workContext.WorkingLanguage, false);+ model.OrderSubtotalInclTax = _priceFormatter.FormatPrice(order.OrderSubtotalInclTax, orderCurrency);+ model.OrderSubtotalExclTax = _priceFormatter.FormatPrice(order.OrderSubtotalExclTax, orderCurrency);model.OrderSubtotalInclTaxValue = order.OrderSubtotalInclTax;model.OrderSubtotalExclTaxValue = order.OrderSubtotalExclTax;//discount (applied to order subtotal)- var orderSubtotalDiscountInclTaxStr = _priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax,- orderCurrency, _workContext.WorkingLanguage, true);- var orderSubtotalDiscountExclTaxStr = _priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax,- orderCurrency, _workContext.WorkingLanguage, false);+ var orderSubtotalDiscountInclTaxStr =+ _priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax, orderCurrency);+ var orderSubtotalDiscountExclTaxStr =+ _priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax, orderCurrency);if (order.OrderSubTotalDiscountInclTax > 0)model.OrderSubTotalDiscountInclTax = orderSubtotalDiscountInclTaxStr;if (order.OrderSubTotalDiscountExclTax > 0)@@ -472,36 +470,32 @@ namespace Grand.Web.Admin.Servicesmodel.OrderSubTotalDiscountExclTaxValue = order.OrderSubTotalDiscountExclTax;//shipping- model.OrderShippingInclTax = _priceFormatter.FormatShippingPrice(order.OrderShippingInclTax, orderCurrency,- _workContext.WorkingLanguage, true);- model.OrderShippingExclTax = _priceFormatter.FormatShippingPrice(order.OrderShippingExclTax, orderCurrency,- _workContext.WorkingLanguage, false);+ model.OrderShippingInclTax = _priceFormatter.FormatPrice(order.OrderShippingInclTax, orderCurrency);+ model.OrderShippingExclTax = _priceFormatter.FormatPrice(order.OrderShippingExclTax, orderCurrency);model.OrderShippingInclTaxValue = order.OrderShippingInclTax;model.OrderShippingExclTaxValue = order.OrderShippingExclTax;//payment method additional feeif (order.PaymentMethodAdditionalFeeInclTax > 0){- model.PaymentMethodAdditionalFeeInclTax = _priceFormatter.FormatPaymentMethodAdditionalFee(- order.PaymentMethodAdditionalFeeInclTax, orderCurrency, _workContext.WorkingLanguage, true);- model.PaymentMethodAdditionalFeeExclTax = _priceFormatter.FormatPaymentMethodAdditionalFee(- order.PaymentMethodAdditionalFeeExclTax, orderCurrency, _workContext.WorkingLanguage, false);+ model.PaymentMethodAdditionalFeeInclTax =+ _priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeInclTax, orderCurrency);+ model.PaymentMethodAdditionalFeeExclTax =+ _priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeExclTax, orderCurrency);}model.PaymentMethodAdditionalFeeInclTaxValue = order.PaymentMethodAdditionalFeeInclTax;model.PaymentMethodAdditionalFeeExclTaxValue = order.PaymentMethodAdditionalFeeExclTax;//tax- model.Tax = await _priceFormatter.FormatPrice(order.OrderTax, order.CustomerCurrencyCode, false,- _workContext.WorkingLanguage);+ model.Tax = _priceFormatter.FormatPrice(order.OrderTax, orderCurrency);var displayTaxRates = _taxSettings.DisplayTaxRates && order.OrderTaxes.Any();var displayTax = !displayTaxRates;foreach (var tr in order.OrderTaxes){model.TaxRates.Add(new OrderModel.TaxRate {Rate = _priceFormatter.FormatTaxRate(tr.Percent),- Value = await _priceFormatter.FormatPrice(tr.Amount, order.CustomerCurrencyCode, false,- _workContext.WorkingLanguage)+ Value = _priceFormatter.FormatPrice(tr.Amount, orderCurrency)});}@@ -512,8 +506,7 @@ namespace Grand.Web.Admin.Services//discountif (order.OrderDiscount > 0)- model.OrderTotalDiscount = await _priceFormatter.FormatPrice(-order.OrderDiscount,- order.CustomerCurrencyCode, false, _workContext.WorkingLanguage);+ model.OrderTotalDiscount = _priceFormatter.FormatPrice(-order.OrderDiscount, orderCurrency);model.OrderTotalDiscountValue = order.OrderDiscount;//gift vouchers@@ -524,8 +517,7 @@ namespace Grand.Web.Admin.Services{model.GiftVouchers.Add(new OrderModel.GiftVoucher {CouponCode = giftVoucher.Code,- Amount = await _priceFormatter.FormatPrice(-gcuh.UsedValue, order.CustomerCurrencyCode, false,- _workContext.WorkingLanguage)+ Amount = _priceFormatter.FormatPrice(-gcuh.UsedValue, orderCurrency)});}}@@ -534,27 +526,22 @@ namespace Grand.Web.Admin.Servicesif (order.RedeemedLoyaltyPoints > 0){model.RedeemedLoyaltyPoints = order.RedeemedLoyaltyPoints;- model.RedeemedLoyaltyPointsAmount = await _priceFormatter.FormatPrice(- -order.RedeemedLoyaltyPointsAmount, order.CustomerCurrencyCode, false,- _workContext.WorkingLanguage);+ model.RedeemedLoyaltyPointsAmount = _priceFormatter.FormatPrice(-order.RedeemedLoyaltyPointsAmount, orderCurrency);}//total- model.OrderTotal = await _priceFormatter.FormatPrice(order.OrderTotal, order.CustomerCurrencyCode, false,- _workContext.WorkingLanguage);+ model.OrderTotal = _priceFormatter.FormatPrice(order.OrderTotal, orderCurrency);model.OrderTotalValue = order.OrderTotal;model.CurrencyRate = order.CurrencyRate;model.CurrencyCode = order.CustomerCurrencyCode;//refunded amountif (order.RefundedAmount > 0)- model.RefundedAmount = await _priceFormatter.FormatPrice(order.RefundedAmount,- order.CustomerCurrencyCode, false, _workContext.WorkingLanguage);+ model.RefundedAmount = _priceFormatter.FormatPrice(order.RefundedAmount, orderCurrency);var suggestedRefundedAmount = order.OrderItems.Sum(x => x.CancelAmount);if (suggestedRefundedAmount > 0)- model.SuggestedRefundedAmount = await _priceFormatter.FormatPrice(suggestedRefundedAmount,- order.CustomerCurrencyCode, false, _workContext.WorkingLanguage);+ model.SuggestedRefundedAmount = _priceFormatter.FormatPrice(suggestedRefundedAmount, orderCurrency);//used discountsvar duh = await _discountService.GetAllDiscountUsageHistory(orderId: order.Id);@@ -579,50 +566,38 @@ namespace Grand.Web.Admin.Servicesvar profit = Convert.ToDouble(order.OrderTotal / order.CurrencyRate -order.OrderShippingExclTax / order.CurrencyRate -order.OrderTax / order.CurrencyRate - productCost);- model.Profit = await _priceFormatter.FormatPrice(profit, order.PrimaryCurrencyCode, false,- _workContext.WorkingLanguage);+ model.Profit = _priceFormatter.FormatPrice(profit, primaryStoreCurrency);}}if (order.PrimaryCurrencyCode != order.CustomerCurrencyCode){- model.OrderTotal +=- $" ({await _priceFormatter.FormatPrice(order.OrderTotal / order.CurrencyRate, order.PrimaryCurrencyCode, false, _workContext.WorkingLanguage)})";- model.OrderSubtotalInclTax +=- $" ({await _priceFormatter.FormatPrice(order.OrderSubtotalInclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, true)})";- model.OrderSubtotalExclTax +=- $" ({await _priceFormatter.FormatPrice(order.OrderSubtotalExclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, false)})";+ model.OrderTotal += $" ({_priceFormatter.FormatPrice(order.OrderTotal / order.CurrencyRate, primaryStoreCurrency)})";+ model.OrderSubtotalInclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubtotalInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ model.OrderSubtotalExclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubtotalExclTax / order.CurrencyRate, primaryStoreCurrency)})";//discount (applied to order subtotal)if (order.OrderSubTotalDiscountInclTax > 0)- model.OrderSubTotalDiscountInclTax +=- $" ({await _priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, true)})";+ model.OrderSubTotalDiscountInclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax / order.CurrencyRate, primaryStoreCurrency)})";if (order.OrderSubTotalDiscountExclTax > 0)- model.OrderSubTotalDiscountExclTax +=- $" ({await _priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, false)})";+ model.OrderSubTotalDiscountExclTax += $" ({_priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax / order.CurrencyRate, primaryStoreCurrency)})";//shipping- model.OrderShippingInclTax +=- $" ({await _priceFormatter.FormatShippingPrice(order.OrderShippingInclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, true)})";- model.OrderShippingExclTax +=- $" ({await _priceFormatter.FormatShippingPrice(order.OrderShippingExclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, false)})";+ model.OrderShippingInclTax += $" ({_priceFormatter.FormatPrice(order.OrderShippingInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ model.OrderShippingExclTax += $" ({_priceFormatter.FormatPrice(order.OrderShippingExclTax / order.CurrencyRate, primaryStoreCurrency)})";//payment method additional feeif (order.PaymentMethodAdditionalFeeInclTax > 0){- model.PaymentMethodAdditionalFeeInclTax +=- $" ({await _priceFormatter.FormatPaymentMethodAdditionalFee(order.PaymentMethodAdditionalFeeInclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, true)})";- model.PaymentMethodAdditionalFeeExclTax +=- $" ({await _priceFormatter.FormatPaymentMethodAdditionalFee(order.PaymentMethodAdditionalFeeExclTax / order.CurrencyRate, order.PrimaryCurrencyCode, _workContext.WorkingLanguage, false)})";+ model.PaymentMethodAdditionalFeeInclTax += $" ({_priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ model.PaymentMethodAdditionalFeeExclTax += $" ({_priceFormatter.FormatPrice(order.PaymentMethodAdditionalFeeExclTax / order.CurrencyRate, primaryStoreCurrency)})";}- model.Tax +=- $" ({await _priceFormatter.FormatPrice(order.OrderTax / order.CurrencyRate, order.PrimaryCurrencyCode, false, _workContext.WorkingLanguage)})";+ model.Tax += $" ({_priceFormatter.FormatPrice(order.OrderTax / order.CurrencyRate, primaryStoreCurrency)})";//refunded amountif (order.RefundedAmount > 0)- model.RefundedAmount +=- $" ({await _priceFormatter.FormatPrice(order.RefundedAmount / order.CurrencyRate, order.PrimaryCurrencyCode, false, _workContext.WorkingLanguage)})";+ model.RefundedAmount += $" ({_priceFormatter.FormatPrice(order.RefundedAmount / order.CurrencyRate, primaryStoreCurrency)})";}#endregion@@ -769,7 +744,7 @@ namespace Grand.Web.Admin.Servicesvar product = await _productService.GetProductByIdIncludeArch(orderItem.ProductId);if (product == null) continue;-+if (product.IsDownload)hasDownloadableItems = true;@@ -810,45 +785,32 @@ namespace Grand.Web.Admin.Services//unit priceorderItemModel.UnitPriceInclTaxValue = orderItem.UnitPriceInclTax;orderItemModel.UnitPriceExclTaxValue = orderItem.UnitPriceExclTax;- orderItemModel.UnitPriceInclTax = _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax,- orderCurrency, _workContext.WorkingLanguage, true, true);- orderItemModel.UnitPriceExclTax = _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax,- orderCurrency, _workContext.WorkingLanguage, false, true);+ orderItemModel.UnitPriceInclTax = _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax, orderCurrency);+ orderItemModel.UnitPriceExclTax = _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax, orderCurrency);//discountsorderItemModel.DiscountInclTaxValue = orderItem.DiscountAmountInclTax;orderItemModel.DiscountExclTaxValue = orderItem.DiscountAmountExclTax;- orderItemModel.DiscountInclTax = _priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax,- orderCurrency, _workContext.WorkingLanguage, true, true);- orderItemModel.DiscountExclTax = _priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax,- orderCurrency, _workContext.WorkingLanguage, false, true);+ orderItemModel.DiscountInclTax = _priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax, orderCurrency);+ orderItemModel.DiscountExclTax = _priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax, orderCurrency);//subtotalorderItemModel.SubTotalInclTaxValue = orderItem.PriceInclTax;orderItemModel.SubTotalExclTaxValue = orderItem.PriceExclTax;- orderItemModel.SubTotalInclTax = _priceFormatter.FormatPrice(orderItem.PriceInclTax, orderCurrency,- _workContext.WorkingLanguage, false, false);- orderItemModel.SubTotalExclTax = _priceFormatter.FormatPrice(orderItem.PriceExclTax, orderCurrency,- _workContext.WorkingLanguage, false, true);+ orderItemModel.SubTotalInclTax = _priceFormatter.FormatPrice(orderItem.PriceInclTax, orderCurrency);+ orderItemModel.SubTotalExclTax = _priceFormatter.FormatPrice(orderItem.PriceExclTax, orderCurrency);if (order.PrimaryCurrencyCode != order.CustomerCurrencyCode){- orderItemModel.UnitPriceInclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceInclTax / order.CurrencyRate, primaryStoreCurrency, _workContext.WorkingLanguage, true, true)})";- orderItemModel.UnitPriceExclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceExclTax / order.CurrencyRate, primaryStoreCurrency, _workContext.WorkingLanguage, false, true)})";- orderItemModel.DiscountInclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax / order.CurrencyRate, primaryStoreCurrency, _workContext.WorkingLanguage, true, true)})";- orderItemModel.DiscountExclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax / order.CurrencyRate, primaryStoreCurrency, _workContext.WorkingLanguage, false, true)})";- orderItemModel.SubTotalInclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.PriceInclTax / order.CurrencyRate, primaryStoreCurrency, _workContext.WorkingLanguage, false, false)})";- orderItemModel.SubTotalExclTax +=- $" ({_priceFormatter.FormatPrice(orderItem.PriceExclTax / order.CurrencyRate, primaryStoreCurrency, _workContext.WorkingLanguage, false, true)})";+ orderItemModel.UnitPriceInclTax += $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.UnitPriceExclTax += $" ({_priceFormatter.FormatPrice(orderItem.UnitPriceExclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.DiscountInclTax += $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.DiscountExclTax += $" ({_priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.SubTotalInclTax += $" ({_priceFormatter.FormatPrice(orderItem.PriceInclTax / order.CurrencyRate, primaryStoreCurrency)})";+ orderItemModel.SubTotalExclTax += $" ({_priceFormatter.FormatPrice(orderItem.PriceExclTax / order.CurrencyRate, primaryStoreCurrency)})";}// commissionorderItemModel.CommissionValue = orderItem.Commission;- orderItemModel.Commission = _priceFormatter.FormatPrice(orderItem.Commission, orderCurrency,- _workContext.WorkingLanguage, false, false);+ orderItemModel.Commission = _priceFormatter.FormatPrice(orderItem.Commission, orderCurrency);orderItemModel.AttributeInfo = orderItem.AttributeDescription;if (product.IsRecurring)diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetFormatBasePriceHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetFormatBasePriceHandler.csindex bfe4b1401..e7ce8148e 100644--- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetFormatBasePriceHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetFormatBasePriceHandler.cs@@ -50,7 +50,7 @@ namespace Grand.Web.Features.Handlers.Catalog//do not round. otherwise, it can cause issuesawait _measureService.ConvertWeight(productAmount, productUnit, referenceUnit, false) *referenceAmount;- var basePriceStr = _priceFormatter.FormatPrice(basePrice, false);+ var basePriceStr = _priceFormatter.FormatPrice(basePrice);var result = string.Format(_translationService.GetResource("Products.BasePrice"),basePriceStr, referenceAmount.ToString("G29"), referenceUnit.Name);diff --git a/src/Web/Grand.Web/Features/Handlers/Checkout/GetPaymentMethodHandler.cs b/src/Web/Grand.Web/Features/Handlers/Checkout/GetPaymentMethodHandler.csindex f1ea56805..9c08b417d 100644--- a/src/Web/Grand.Web/Features/Handlers/Checkout/GetPaymentMethodHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Checkout/GetPaymentMethodHandler.cs@@ -58,7 +58,7 @@ namespace Grand.Web.Features.Handlers.Checkout_orderTotalCalculationService.CheckMinimumLoyaltyPointsToUseRequirement(loyaltyPointsBalance)){model.DisplayLoyaltyPoints = true;- model.LoyaltyPointsAmount = _priceFormatter.FormatPrice(loyaltyPointsAmount, false);+ model.LoyaltyPointsAmount = _priceFormatter.FormatPrice(loyaltyPointsAmount, request.Currency);model.LoyaltyPointsBalance = loyaltyPointsBalance;var shoppingCartTotalBase = (await _orderTotalCalculationService.GetShoppingCartTotal(request.Cart, useLoyaltyPoints: true)).shoppingCartTotal;model.LoyaltyPointsEnoughToPayForOrder = shoppingCartTotalBase is 0;@@ -89,7 +89,7 @@ namespace Grand.Web.Features.Handlers.Checkoutvar paymentMethodAdditionalFee = await _paymentService.GetAdditionalHandlingFee(request.Cart, pm.SystemName);var rate = (await _taxService.GetPaymentMethodAdditionalFee(paymentMethodAdditionalFee, request.Customer)).paymentPrice;if (rate > 0)- pmModel.Fee = _priceFormatter.FormatPaymentMethodAdditionalFee(rate);+ pmModel.Fee = _priceFormatter.FormatPrice(rate, request.Currency);model.PaymentMethods.Add(pmModel);}diff --git a/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingAddressHandler.cs b/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingAddressHandler.csindex 8fe987a14..3cfc6fa16 100644--- a/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingAddressHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingAddressHandler.cs@@ -105,7 +105,7 @@ namespace Grand.Web.Features.Handlers.Checkout{var amount = (await _taxService.GetShippingPrice(pickupPoint.PickupFee, request.Customer)).shippingPrice;amount = await _currencyService.ConvertFromPrimaryStoreCurrency(amount, request.Currency);- pickupPointModel.PickupFee = _priceFormatter.FormatShippingPrice(amount);+ pickupPointModel.PickupFee = _priceFormatter.FormatPrice(amount, request.Currency);}model.PickupPoints.Add(pickupPointModel);}diff --git a/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingMethodHandler.cs b/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingMethodHandler.csindex 6dacc4f8b..ab7db6113 100644--- a/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingMethodHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Checkout/GetShippingMethodHandler.cs@@ -65,7 +65,7 @@ namespace Grand.Web.Features.Handlers.CheckoutshippingOption.Rate, request.Cart)).shippingRate;var rateBase = (await _taxService.GetShippingPrice(shippingTotal, request.Customer)).shippingPrice;- soModel.Fee = _priceFormatter.FormatShippingPrice(rateBase);+ soModel.Fee = _priceFormatter.FormatPrice(rateBase);model.ShippingMethods.Add(soModel);}diff --git a/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerLoyaltyPointsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerLoyaltyPointsHandler.csindex 39b808432..ed498e562 100644--- a/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerLoyaltyPointsHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerLoyaltyPointsHandler.cs@@ -47,13 +47,13 @@ namespace Grand.Web.Features.Handlers.Ordersvar loyaltyPointsAmountBase = await _orderTotalCalculationService.ConvertLoyaltyPointsToAmount(loyaltyPointsBalance);var loyaltyPointsAmount = await _currencyService.ConvertFromPrimaryStoreCurrency(loyaltyPointsAmountBase, request.Currency);model.LoyaltyPointsBalance = loyaltyPointsBalance;- model.LoyaltyPointsAmount = _priceFormatter.FormatPrice(loyaltyPointsAmount, false);+ model.LoyaltyPointsAmount = _priceFormatter.FormatPrice(loyaltyPointsAmount, request.Currency);//minimum amount/balancevar minimumLoyaltyPointsBalance = _loyaltyPointsSettings.MinimumLoyaltyPointsToUse;var minimumLoyaltyPointsAmountBase = await _orderTotalCalculationService.ConvertLoyaltyPointsToAmount(minimumLoyaltyPointsBalance);var minimumLoyaltyPointsAmount = await _currencyService.ConvertFromPrimaryStoreCurrency(minimumLoyaltyPointsAmountBase, request.Currency);model.MinimumLoyaltyPointsBalance = minimumLoyaltyPointsBalance;- model.MinimumLoyaltyPointsAmount = _priceFormatter.FormatPrice(minimumLoyaltyPointsAmount, false);+ model.MinimumLoyaltyPointsAmount = _priceFormatter.FormatPrice(minimumLoyaltyPointsAmount, request.Currency);return model;}diff --git a/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerOrderListHandler.cs b/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerOrderListHandler.csindex 439138690..b558ad33a 100644--- a/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerOrderListHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Orders/GetCustomerOrderListHandler.cs@@ -20,6 +20,7 @@ namespace Grand.Web.Features.Handlers.Ordersprivate readonly IMediator _mediator;private readonly IOrderStatusService _orderStatusService;private readonly IOrderService _orderService;+ private readonly ICurrencyService _currencyService;private readonly OrderSettings _orderSettings;public GetCustomerOrderListHandler(@@ -30,6 +31,7 @@ namespace Grand.Web.Features.Handlers.OrdersIPriceFormatter priceFormatter,IOrderStatusService orderStatusService,IOrderService orderService,+ ICurrencyService currencyService,OrderSettings orderSettings){_dateTimeService = dateTimeService;@@ -39,6 +41,7 @@ namespace Grand.Web.Features.Handlers.Orders_orderStatusService = orderStatusService;_orderService = orderService;_orderSettings = orderSettings;+ _currencyService = currencyService;_mediator = mediator;}@@ -73,6 +76,7 @@ namespace Grand.Web.Features.Handlers.Ordersmodel.PagingContext.LoadPagedList(orders);+foreach (var order in orders){var status = await _orderStatusService.GetByStatusId(order.OrderStatusId);@@ -88,7 +92,7 @@ namespace Grand.Web.Features.Handlers.OrdersPaymentStatus = order.PaymentStatusId.GetTranslationEnum(_translationService, request.Language.Id),ShippingStatus = order.ShippingStatusId.GetTranslationEnum(_translationService, request.Language.Id),IsMerchandiseReturnAllowed = await _mediator.Send(new IsMerchandiseReturnAllowedQuery { Order = order }),- OrderTotal = await _priceFormatter.FormatPrice(order.OrderTotal, order.CustomerCurrencyCode, false, request.Language)+ OrderTotal = _priceFormatter.FormatPrice(order.OrderTotal, await _currencyService.GetCurrencyByCode(order.CustomerCurrencyCode))};model.Orders.Add(orderModel);diff --git a/src/Web/Grand.Web/Features/Handlers/Orders/GetMerchandiseReturnHandler.cs b/src/Web/Grand.Web/Features/Handlers/Orders/GetMerchandiseReturnHandler.csindex 065d33ff6..57a847021 100644--- a/src/Web/Grand.Web/Features/Handlers/Orders/GetMerchandiseReturnHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Orders/GetMerchandiseReturnHandler.cs@@ -27,6 +27,7 @@ namespace Grand.Web.Features.Handlers.Ordersprivate readonly ICountryService _countryService;private readonly IAclService _aclService;private readonly IVendorService _vendorService;+ private readonly ICurrencyService _currencyService;private readonly IMediator _mediator;private readonly OrderSettings _orderSettings;@@ -40,8 +41,8 @@ namespace Grand.Web.Features.Handlers.OrdersIAclService aclService,IVendorService vendorService,IMediator mediator,- OrderSettings orderSettings- )+ OrderSettings orderSettings,+ ICurrencyService currencyService){_workContext = workContext;_merchandiseReturnService = merchandiseReturnService;@@ -53,6 +54,7 @@ namespace Grand.Web.Features.Handlers.Orders_vendorService = vendorService;_mediator = mediator;_orderSettings = orderSettings;+ _currencyService = currencyService;}public async Task<MerchandiseReturnModel> Handle(GetMerchandiseReturn request,@@ -107,7 +109,7 @@ namespace Grand.Web.Features.Handlers.Ordersprivate async Task PrepareItems(GetMerchandiseReturn request, MerchandiseReturnModel model){var shipments = await _shipmentService.GetShipmentsByOrder(request.Order.Id);-+ var currency = await _currencyService.GetCurrencyByCode(request.Order.CustomerCurrencyCode);foreach (var orderItem in request.Order.OrderItems){var qtyDelivery = shipments.Where(x => x.DeliveryDateUtc.HasValue).SelectMany(x => x.ShipmentItems)@@ -135,19 +137,10 @@ namespace Grand.Web.Features.Handlers.Orders};if (orderItemModel.Quantity > 0)model.Items.Add(orderItemModel);- //unit price- if (request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax)- {- //including tax- orderItemModel.UnitPrice = await _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax,- request.Order.CustomerCurrencyCode, _workContext.WorkingLanguage, true);- }- else- {- //excluding tax- orderItemModel.UnitPrice = await _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax,- request.Order.CustomerCurrencyCode, _workContext.WorkingLanguage, false);- }++ orderItemModel.IncludingTax = request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax;+ orderItemModel.UnitPrice = _priceFormatter.FormatPrice(request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax ?+ orderItem.UnitPriceInclTax : orderItem.UnitPriceExclTax, currency);}}diff --git a/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.csindex 78cccf069..da0ddbb5f 100644--- a/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Orders/GetOrderDetailsHandler.cs@@ -11,6 +11,7 @@ using Grand.Business.Core.Interfaces.Storage;using Grand.Business.Core.Queries.Checkout.Orders;using Grand.Domain.Catalog;using Grand.Domain.Common;+using Grand.Domain.Directory;using Grand.Domain.Orders;using Grand.Domain.Payments;using Grand.Domain.Shipping;@@ -37,12 +38,14 @@ namespace Grand.Web.Features.Handlers.Ordersprivate readonly IOrderService _orderService;private readonly IPictureService _pictureService;private readonly IOrderStatusService _orderStatusService;+ private readonly ICurrencyService _currencyService;private readonly IMediator _mediator;private readonly CatalogSettings _catalogSettings;private readonly OrderSettings _orderSettings;private readonly PdfSettings _pdfSettings;private readonly TaxSettings _taxSettings;+ private Currency _orderCurrency;public GetOrderDetailsHandler(IDateTimeService dateTimeService,IProductService productService,@@ -55,6 +58,7 @@ namespace Grand.Web.Features.Handlers.OrdersIOrderService orderService,IPictureService pictureService,IOrderStatusService orderStatusService,+ ICurrencyService currencyService,IMediator mediator,CatalogSettings catalogSettings,OrderSettings orderSettings,@@ -72,6 +76,7 @@ namespace Grand.Web.Features.Handlers.Orders_orderService = orderService;_pictureService = pictureService;_orderStatusService = orderStatusService;+ _currencyService = currencyService;_mediator = mediator;_orderSettings = orderSettings;_catalogSettings = catalogSettings;@@ -81,6 +86,7 @@ namespace Grand.Web.Features.Handlers.Orderspublic async Task<OrderDetailsModel> Handle(GetOrderDetails request, CancellationToken cancellationToken){+ _orderCurrency = await _currencyService.GetCurrencyByCode(request.Order.CustomerCurrencyCode);var model = new OrderDetailsModel {Id = request.Order.Id,OrderNumber = request.Order.OrderNumber,@@ -202,59 +208,57 @@ namespace Grand.Web.Features.Handlers.Ordersmodel.CanRePostProcessPayment = paymentTransaction != null && await _paymentService.CanRePostRedirectPayment(paymentTransaction);}- private async Task PrepareOrderTotal(GetOrderDetails request, OrderDetailsModel model)+ private Task PrepareOrderTotal(GetOrderDetails request, OrderDetailsModel model){+ model.OrderIncludingTax = request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax;if (request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal){//including tax-//order subtotal- model.OrderSubtotal = await _priceFormatter.FormatPrice(request.Order.OrderSubtotalInclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ model.OrderSubtotal = _priceFormatter.FormatPrice(request.Order.OrderSubtotalInclTax, _orderCurrency);//discount (applied to order subtotal)if (request.Order.OrderSubTotalDiscountInclTax > 0)- model.OrderSubTotalDiscount = await _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountInclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ model.OrderSubTotalDiscount = _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountInclTax, _orderCurrency);}else{//excluding tax-//order subtotal- model.OrderSubtotal = await _priceFormatter.FormatPrice(request.Order.OrderSubtotalExclTax, request.Order.CustomerCurrencyCode, request.Language, false);+ model.OrderSubtotal = _priceFormatter.FormatPrice(request.Order.OrderSubtotalExclTax, _orderCurrency);//discount (applied to order subtotal)if (request.Order.OrderSubTotalDiscountExclTax > 0)- model.OrderSubTotalDiscount = await _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountExclTax, request.Order.CustomerCurrencyCode, request.Language, false);+ model.OrderSubTotalDiscount = _priceFormatter.FormatPrice(-request.Order.OrderSubTotalDiscountExclTax, _orderCurrency);}if (request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax){//including tax-//order shipping- model.OrderShipping = await _priceFormatter.FormatShippingPrice(request.Order.OrderShippingInclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ model.OrderShipping = _priceFormatter.FormatPrice(request.Order.OrderShippingInclTax, _orderCurrency);//payment method additional feeif (request.Order.PaymentMethodAdditionalFeeInclTax > 0)- model.PaymentMethodAdditionalFee = await _priceFormatter.FormatPaymentMethodAdditionalFee(request.Order.PaymentMethodAdditionalFeeInclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ model.PaymentMethodAdditionalFee = _priceFormatter.FormatPrice(request.Order.PaymentMethodAdditionalFeeInclTax, _orderCurrency);}else{//excluding tax-//order shipping- model.OrderShipping = await _priceFormatter.FormatShippingPrice(request.Order.OrderShippingExclTax, request.Order.CustomerCurrencyCode, request.Language, false);+ model.OrderShipping = _priceFormatter.FormatPrice(request.Order.OrderShippingExclTax, _orderCurrency);//payment method additional feeif (request.Order.PaymentMethodAdditionalFeeExclTax > 0)- model.PaymentMethodAdditionalFee = await _priceFormatter.FormatPaymentMethodAdditionalFee(request.Order.PaymentMethodAdditionalFeeExclTax, request.Order.CustomerCurrencyCode, request.Language, false);+ model.PaymentMethodAdditionalFee = _priceFormatter.FormatPrice(request.Order.PaymentMethodAdditionalFeeExclTax, _orderCurrency);}//total- model.OrderTotal = await _priceFormatter.FormatPrice(request.Order.OrderTotal, request.Order.CustomerCurrencyCode, false, request.Language);-+ model.OrderTotal = _priceFormatter.FormatPrice(request.Order.OrderTotal, _orderCurrency);+ return Task.CompletedTask;}private async Task PrepareTax(GetOrderDetails request, OrderDetailsModel model){var displayTax = true;var displayTaxRates = true;+ var currency = await _currencyService.GetCurrencyByCode(request.Order.CustomerCurrencyCode);if (_taxSettings.HideTaxInOrderSummary && request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax){displayTax = false;@@ -272,13 +276,13 @@ namespace Grand.Web.Features.Handlers.OrdersdisplayTaxRates = _taxSettings.DisplayTaxRates && request.Order.OrderTaxes.Any();displayTax = !displayTaxRates;- model.Tax = await _priceFormatter.FormatPrice(request.Order.OrderTax, request.Order.CustomerCurrencyCode, false, request.Language);+ model.Tax = _priceFormatter.FormatPrice(request.Order.OrderTax, currency);foreach (var tr in request.Order.OrderTaxes){model.TaxRates.Add(new OrderDetailsModel.TaxRate {Rate = _priceFormatter.FormatTaxRate(tr.Percent),- Value = await _priceFormatter.FormatPrice(tr.Amount, request.Order.CustomerCurrencyCode, false, request.Language)+ Value = _priceFormatter.FormatPrice(tr.Amount, currency)});}}@@ -289,10 +293,12 @@ namespace Grand.Web.Features.Handlers.Orders}- private async Task PrepareDiscount(GetOrderDetails request, OrderDetailsModel model)+ private Task PrepareDiscount(GetOrderDetails request, OrderDetailsModel model){if (request.Order.OrderDiscount > 0)- model.OrderTotalDiscount = await _priceFormatter.FormatPrice(-request.Order.OrderDiscount, request.Order.CustomerCurrencyCode, false, request.Language);+ model.OrderTotalDiscount = _priceFormatter.FormatPrice(-request.Order.OrderDiscount, _orderCurrency);++ return Task.CompletedTask;}private async Task PrepareGiftVouchers(GetOrderDetails request, OrderDetailsModel model)@@ -302,20 +308,20 @@ namespace Grand.Web.Features.Handlers.Ordersvar giftVoucher = await _giftVoucherService.GetGiftVoucherById(gcuh.GiftVoucherId);model.GiftVouchers.Add(new OrderDetailsModel.GiftVoucher {CouponCode = giftVoucher.Code,- Amount = await _priceFormatter.FormatPrice(-gcuh.UsedValue, request.Order.CustomerCurrencyCode, false, request.Language)+ Amount = _priceFormatter.FormatPrice(-gcuh.UsedValue, _orderCurrency)});}}- private async Task PrepareLoyaltyPoints(GetOrderDetails request, OrderDetailsModel model)+ private Task PrepareLoyaltyPoints(GetOrderDetails request, OrderDetailsModel model){if (request.Order.RedeemedLoyaltyPoints > 0){model.RedeemedLoyaltyPoints = request.Order.RedeemedLoyaltyPoints;- model.RedeemedLoyaltyPointsAmount = await _priceFormatter.FormatPrice(-request.Order.RedeemedLoyaltyPointsAmount, request.Order.CustomerCurrencyCode, false, request.Language);+ model.RedeemedLoyaltyPointsAmount = _priceFormatter.FormatPrice(-request.Order.RedeemedLoyaltyPointsAmount, _orderCurrency);}-+ return Task.CompletedTask;}private async Task PrepareOrderNotes(GetOrderDetails request, OrderDetailsModel model)@@ -354,39 +360,35 @@ namespace Grand.Web.Features.Handlers.Orders};//prepare pictureorderItemModel.Picture = await PrepareOrderItemPicture(product, orderItem.Attributes, orderItemModel.ProductName);-- model.Items.Add(orderItemModel);-+++ orderItemModel.UnitPriceIncludingTax = request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax;//unit price, subtotalif (request.Order.CustomerTaxDisplayTypeId == TaxDisplayType.IncludingTax){//including tax- orderItemModel.UnitPrice = await _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ orderItemModel.UnitPrice = _priceFormatter.FormatPrice(orderItem.UnitPriceInclTax, _orderCurrency);orderItemModel.UnitPriceValue = orderItem.UnitPriceInclTax;- orderItemModel.UnitPriceWithoutDiscount = await _priceFormatter.FormatPrice(orderItem.UnitPriceWithoutDiscInclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ orderItemModel.UnitPriceWithoutDiscount = _priceFormatter.FormatPrice(orderItem.UnitPriceWithoutDiscInclTax, _orderCurrency);orderItemModel.UnitPriceWithoutDiscountValue = orderItem.UnitPriceWithoutDiscInclTax;- orderItemModel.SubTotal = await _priceFormatter.FormatPrice(orderItem.PriceInclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ orderItemModel.SubTotal = _priceFormatter.FormatPrice(orderItem.PriceInclTax, _orderCurrency);if (orderItem.DiscountAmountInclTax > 0)- {- orderItemModel.Discount = await _priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax, request.Order.CustomerCurrencyCode, request.Language, true);- }+ orderItemModel.Discount = _priceFormatter.FormatPrice(orderItem.DiscountAmountInclTax, _orderCurrency);}else{//excluding tax- orderItemModel.UnitPrice = await _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax, request.Order.CustomerCurrencyCode, request.Language, false);+ orderItemModel.UnitPrice = _priceFormatter.FormatPrice(orderItem.UnitPriceExclTax, _orderCurrency);orderItemModel.UnitPriceValue = orderItem.UnitPriceExclTax;- orderItemModel.UnitPriceWithoutDiscount = await _priceFormatter.FormatPrice(orderItem.UnitPriceWithoutDiscExclTax, request.Order.CustomerCurrencyCode, request.Language, true);+ orderItemModel.UnitPriceWithoutDiscount = _priceFormatter.FormatPrice(orderItem.UnitPriceWithoutDiscExclTax, _orderCurrency);orderItemModel.UnitPriceWithoutDiscountValue = orderItem.UnitPriceWithoutDiscExclTax;- orderItemModel.SubTotal = await _priceFormatter.FormatPrice(orderItem.PriceExclTax, request.Order.CustomerCurrencyCode, request.Language, false);+ orderItemModel.SubTotal = _priceFormatter.FormatPrice(orderItem.PriceExclTax, _orderCurrency);if (orderItem.DiscountAmountExclTax > 0)- {- orderItemModel.Discount = await _priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax, request.Order.CustomerCurrencyCode, request.Language, true);- }+ orderItemModel.Discount = _priceFormatter.FormatPrice(orderItem.DiscountAmountExclTax, _orderCurrency);}//downloadable products@@ -394,6 +396,8 @@ namespace Grand.Web.Features.Handlers.OrdersorderItemModel.DownloadId = product.DownloadId;if (request.Order.IsLicenseDownloadAllowed(orderItem, product))orderItemModel.LicenseId = !string.IsNullOrEmpty(orderItem.LicenseDownloadId) ? orderItem.LicenseDownloadId : "";++ model.Items.Add(orderItemModel);}}diff --git a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.csindex ab7e460e9..112e845ba 100644--- a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs@@ -832,8 +832,8 @@ namespace Grand.Web.Features.Handlers.Products: minimumCustomerEnteredPrice;model.CustomerEnteredPriceRange = string.Format(_translationService.GetResource("Products.EnterProductPrice.Range"),- _priceFormatter.FormatPrice(minimumCustomerEnteredPrice, false),- _priceFormatter.FormatPrice(maximumCustomerEnteredPrice, false));+ _priceFormatter.FormatPrice(minimumCustomerEnteredPrice),+ _priceFormatter.FormatPrice(maximumCustomerEnteredPrice));return model;}@@ -950,11 +950,11 @@ namespace Grand.Web.Features.Handlers.Products{case > 0:valueModel.PriceAdjustment =- "+" + _priceFormatter.FormatPrice(productprice.productprice, false);+ "+" + _priceFormatter.FormatPrice(productprice.productprice, _workContext.WorkingCurrency);break;case < 0:valueModel.PriceAdjustment =- "-" + _priceFormatter.FormatPrice(-productprice.productprice, false);+ "-" + _priceFormatter.FormatPrice(-productprice.productprice, _workContext.WorkingCurrency);break;}@@ -1095,7 +1095,7 @@ namespace Grand.Web.Features.Handlers.Products_workContext.CurrentCustomer, _workContext.WorkingCurrency,0, _catalogSettings.DisplayTierPricesWithDiscounts, tierPrice.Quantity)).finalPrice);tier.Quantity = tierPrice.Quantity;- tier.Price = _priceFormatter.FormatPrice(priceBase.productprice, false);+ tier.Price = _priceFormatter.FormatPrice(priceBase.productprice, _workContext.WorkingCurrency);model.Add(tier);}diff --git a/src/Web/Grand.Web/Features/Handlers/Products/GetProductOverviewHandler.cs b/src/Web/Grand.Web/Features/Handlers/Products/GetProductOverviewHandler.csindex cae30f877..5cad73321 100644--- a/src/Web/Grand.Web/Features/Handlers/Products/GetProductOverviewHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Products/GetProductOverviewHandler.cs@@ -224,14 +224,12 @@ namespace Grand.Web.Features.Handlers.Products//compare productspriceModel.DisableAddToCompareListButton = !_catalogSettings.CompareProductsEnabled;+ priceModel.PriceIncludesTax = priceIncludesTax;//catalog price, not used in views, but it's for front developerif (product.CatalogPrice > 0){- var catalogPrice =- await _currencyService.ConvertFromPrimaryStoreCurrency(product.CatalogPrice,- _workContext.WorkingCurrency);- priceModel.CatalogPrice = _priceFormatter.FormatPrice(catalogPrice,- _workContext.WorkingCurrency, _workContext.WorkingLanguage, priceIncludesTax);+ var catalogPrice = await _currencyService.ConvertFromPrimaryStoreCurrency(product.CatalogPrice, _workContext.WorkingCurrency);+ priceModel.CatalogPrice = _priceFormatter.FormatPrice(catalogPrice, _workContext.WorkingCurrency);}if (associatedProducts.Any())@@ -272,8 +270,7 @@ namespace Grand.Web.Features.Handlers.ProductspriceModel.OldPrice = null;priceModel.Price = string.Format(res["Products.PriceRangeFrom"],- _priceFormatter.FormatPrice(finalPrice, _workContext.WorkingCurrency,- _workContext.WorkingLanguage, priceIncludesTax));+ _priceFormatter.FormatPrice(finalPrice, _workContext.WorkingCurrency));priceModel.PriceValue = finalPrice;//PAngV base price (used in Germany)@@ -283,12 +280,6 @@ namespace Grand.Web.Features.Handlers.ProductsProductPrice = finalPrice});}- else- {- //Actually it's not possible (we presume that minimalPrice always has a value)- //We never should get here- Debug.WriteLine("Cannot calculate minPrice for product #{0}", product.Id);- }}}else@@ -333,8 +324,7 @@ namespace Grand.Web.Features.Handlers.Productsvar catalogPrice =await _currencyService.ConvertFromPrimaryStoreCurrency(product.CatalogPrice,_workContext.WorkingCurrency);- priceModel.CatalogPrice = _priceFormatter.FormatPrice(catalogPrice,- _workContext.WorkingCurrency, _workContext.WorkingLanguage, priceIncludesTax);+ priceModel.CatalogPrice = _priceFormatter.FormatPrice(catalogPrice, _workContext.WorkingCurrency);}//start price for product auction@@ -343,8 +333,7 @@ namespace Grand.Web.Features.Handlers.Productsvar startPrice =await _currencyService.ConvertFromPrimaryStoreCurrency(product.StartPrice,_workContext.WorkingCurrency);- priceModel.StartPrice = _priceFormatter.FormatPrice(startPrice, _workContext.WorkingCurrency,- _workContext.WorkingLanguage, priceIncludesTax);+ priceModel.StartPrice = _priceFormatter.FormatPrice(startPrice, _workContext.WorkingCurrency);priceModel.StartPriceValue = startPrice;}@@ -354,8 +343,7 @@ namespace Grand.Web.Features.Handlers.Productsvar highestBid =await _currencyService.ConvertFromPrimaryStoreCurrency(product.HighestBid,_workContext.WorkingCurrency);- priceModel.HighestBid = _priceFormatter.FormatPrice(highestBid, _workContext.WorkingCurrency,- _workContext.WorkingLanguage, priceIncludesTax);+ priceModel.HighestBid = _priceFormatter.FormatPrice(highestBid, _workContext.WorkingCurrency);priceModel.HighestBidValue = highestBid;}@@ -375,13 +363,13 @@ namespace Grand.Web.Features.Handlers.Products//prices//calculate for the maximum quantity (in case if we have tier prices)- var infoprice = await _pricingService.GetFinalPrice(product,+ var infoPrice = await _pricingService.GetFinalPrice(product,_workContext.CurrentCustomer, _workContext.WorkingCurrency, 0, true, int.MaxValue);- priceModel.AppliedDiscounts = infoprice.appliedDiscounts;- priceModel.PreferredTierPrice = infoprice.preferredTierPrice;+ priceModel.AppliedDiscounts = infoPrice.appliedDiscounts;+ priceModel.PreferredTierPrice = infoPrice.preferredTierPrice;- var minPossiblePrice = infoprice.finalPrice;+ var minPossiblePrice = infoPrice.finalPrice;var oldPriceBase = (await _taxService.GetProductPrice(product, product.OldPrice,priceIncludesTax, _workContext.CurrentCustomer)).productprice;@@ -412,29 +400,22 @@ namespace Grand.Web.Features.Handlers.Products{priceModel.OldPrice = null;priceModel.Price = string.Format(res["Products.PriceRangeFrom"],- _priceFormatter.FormatPrice(finalPrice, _workContext.WorkingCurrency,- _workContext.WorkingLanguage, priceIncludesTax));+ _priceFormatter.FormatPrice(finalPrice, _workContext.WorkingCurrency));priceModel.PriceValue = finalPrice;}else{- if (finalPrice != oldPriceBase && oldPriceBase != 0)+ if (!finalPrice.Equals(oldPriceBase) && oldPriceBase != 0){- priceModel.OldPrice = _priceFormatter.FormatPrice(oldPrice,- _workContext.WorkingCurrency, _workContext.WorkingLanguage,- priceIncludesTax);+ priceModel.OldPrice = _priceFormatter.FormatPrice(oldPrice, _workContext.WorkingCurrency);priceModel.OldPriceValue = oldPrice;- priceModel.Price = _priceFormatter.FormatPrice(finalPrice,- _workContext.WorkingCurrency, _workContext.WorkingLanguage,- priceIncludesTax);+ priceModel.Price = _priceFormatter.FormatPrice(finalPrice, _workContext.WorkingCurrency);priceModel.PriceValue = finalPrice;}else{priceModel.OldPrice = null;- priceModel.Price = _priceFormatter.FormatPrice(finalPrice,- _workContext.WorkingCurrency, _workContext.WorkingLanguage,- priceIncludesTax);+ priceModel.Price = _priceFormatter.FormatPrice(finalPrice, _workContext.WorkingCurrency);priceModel.PriceValue = finalPrice;}}diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.csindex 931013e0b..55f0fd8ff 100644--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetAddToCartHandler.cs@@ -150,11 +150,12 @@ namespace Grand.Web.Features.Handlers.ShoppingCart{var subTotalIncludingTax = request.TaxDisplayType == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal;var shoppingCartSubTotal = await _orderTotalCalculationService.GetShoppingCartSubTotal(cart, subTotalIncludingTax);- model.SubTotal = _priceFormatter.FormatPrice(shoppingCartSubTotal.subTotalWithoutDiscount, request.Currency, request.Language, subTotalIncludingTax);+ model.SubTotalIncludingTax = subTotalIncludingTax;+ model.SubTotal = _priceFormatter.FormatPrice(shoppingCartSubTotal.subTotalWithoutDiscount, request.Currency);model.DecimalSubTotal = shoppingCartSubTotal.subTotalWithoutDiscount;if (shoppingCartSubTotal.discountAmount > 0){- model.SubTotalDiscount = _priceFormatter.FormatPrice(-shoppingCartSubTotal.discountAmount, request.Currency, request.Language, subTotalIncludingTax);+ model.SubTotalDiscount = _priceFormatter.FormatPrice(-shoppingCartSubTotal.discountAmount, request.Currency);}break;diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.csindex 0d20079c2..7a7a4be43 100644--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingResultHandler.cs@@ -77,7 +77,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar shippingTotal = total.shippingRate;var rate = (await _taxService.GetShippingPrice(shippingTotal, request.Customer)).shippingPrice;- soModel.Price = _priceFormatter.FormatShippingPrice(rate);+ soModel.Price = _priceFormatter.FormatPrice(rate, request.Currency);model.ShippingOptions.Add(soModel);}@@ -93,7 +93,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar shippingTotal = pickupPoints.Max(x => x.PickupFee);var rate = (await _taxService.GetShippingPrice(shippingTotal, request.Customer)).shippingPrice;- soModel.Price = _priceFormatter.FormatShippingPrice(rate);+ soModel.Price = _priceFormatter.FormatPrice(rate, request.Currency);model.ShippingOptions.Add(soModel);}}diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.csindex 16d9dc61c..5f50d3932 100644--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetMiniShoppingCartHandler.cs@@ -109,8 +109,8 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar shoppingCartSubTotal =await _orderTotalCalculationService.GetShoppingCartSubTotal(cart, subTotalIncludingTax);- model.SubTotal = _priceFormatter.FormatPrice(shoppingCartSubTotal.subTotalWithoutDiscount,- request.Currency, request.Language, subTotalIncludingTax);+ model.SubTotalIncludingTax = subTotalIncludingTax;+ model.SubTotal = _priceFormatter.FormatPrice(shoppingCartSubTotal.subTotalWithoutDiscount, request.Currency);var requiresShipping = cart.RequiresShipping();var checkoutAttributesExist =diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.csindex 5bf8ddb37..15a1a5f47 100644--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetOrderTotalsHandler.cs@@ -77,11 +77,12 @@ namespace Grand.Web.Features.Handlers.ShoppingCart{var subTotalIncludingTax = request.TaxDisplayType == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal;var shoppingCartSubTotal = await _orderTotalCalculationService.GetShoppingCartSubTotal(request.Cart, subTotalIncludingTax);- model.SubTotal = _priceFormatter.FormatPrice(shoppingCartSubTotal.subTotalWithoutDiscount, request.Currency, request.Language, subTotalIncludingTax);+ model.SubTotalIncludingTax = subTotalIncludingTax;+ model.SubTotal = _priceFormatter.FormatPrice(shoppingCartSubTotal.subTotalWithoutDiscount, request.Currency);model.SubTotalValue = shoppingCartSubTotal.subTotalWithoutDiscount;if (shoppingCartSubTotal.discountAmount > 0){- model.SubTotalDiscount = _priceFormatter.FormatPrice(-shoppingCartSubTotal.discountAmount, request.Currency, request.Language, subTotalIncludingTax);+ model.SubTotalDiscount = _priceFormatter.FormatPrice(-shoppingCartSubTotal.discountAmount, request.Currency);model.SubTotalDiscountValue = -shoppingCartSubTotal.discountAmount;shoppingCartSubTotal.appliedDiscounts.ForEach(x => model.Discounts.Add(x.DiscountId));}@@ -95,7 +96,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar shoppingCartShippingBase = (await _orderTotalCalculationService.GetShoppingCartShippingTotal(request.Cart)).shoppingCartShippingTotal;if (shoppingCartShippingBase.HasValue){- model.Shipping = _priceFormatter.FormatShippingPrice(shoppingCartShippingBase.Value);+ model.Shipping = _priceFormatter.FormatPrice(shoppingCartShippingBase.Value, request.Currency);//selected shipping methodvar shippingOption = request.Customer.GetUserFieldFromEntity<ShippingOption>(SystemCustomerFieldNames.SelectedShippingOption, request.Store.Id);@@ -114,7 +115,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar paymentMethodAdditionalFeeWithTaxBase = (await _taxService.GetPaymentMethodAdditionalFee(paymentMethodAdditionalFee, request.Customer)).paymentPrice;if (paymentMethodAdditionalFeeWithTaxBase > 0){- model.PaymentMethodAdditionalFee = _priceFormatter.FormatPaymentMethodAdditionalFee(paymentMethodAdditionalFeeWithTaxBase);+ model.PaymentMethodAdditionalFee = _priceFormatter.FormatPrice(paymentMethodAdditionalFeeWithTaxBase, request.Currency);model.PaymentMethodAdditionalFeeValue = paymentMethodAdditionalFeeWithTaxBase;}}@@ -143,12 +144,12 @@ namespace Grand.Web.Features.Handlers.ShoppingCartdisplayTaxRates = _taxSettings.DisplayTaxRates && taxRates.Any();displayTax = !displayTaxRates;- model.Tax = _priceFormatter.FormatPrice(taxtotal.taxtotal, false);+ model.Tax = _priceFormatter.FormatPrice(taxtotal.taxtotal, request.Currency);foreach (var tr in taxRates){model.TaxRates.Add(new OrderTotalsModel.TaxRate {Rate = _priceFormatter.FormatTaxRate(tr.Key),- Value = _priceFormatter.FormatPrice(tr.Value, false)+ Value = _priceFormatter.FormatPrice(tr.Value, request.Currency)});}}@@ -167,13 +168,13 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar redeemedLoyaltyPointsAmount = carttotal.redeemedLoyaltyPointsAmount;if (shoppingCartTotalBase.HasValue){- model.OrderTotal = _priceFormatter.FormatPrice(shoppingCartTotalBase.Value, false);+ model.OrderTotal = _priceFormatter.FormatPrice(shoppingCartTotalBase.Value, request.Currency);model.OrderTotalValue = shoppingCartTotalBase.Value;}//discountif (orderTotalDiscountAmountBase > 0){- model.OrderTotalDiscount = _priceFormatter.FormatPrice(-orderTotalDiscountAmountBase, false);+ model.OrderTotalDiscount = _priceFormatter.FormatPrice(-orderTotalDiscountAmountBase, request.Currency);model.OrderTotalDiscountValue = -orderTotalDiscountAmountBase;carttotal.appliedDiscounts.ForEach(x => model.Discounts.Add(x.DiscountId));}@@ -191,7 +192,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCartif (redeemedLoyaltyPointsAmount > 0){model.RedeemedLoyaltyPoints = redeemedLoyaltyPoints;- model.RedeemedLoyaltyPointsAmount = _priceFormatter.FormatPrice(-redeemedLoyaltyPointsAmount, false);+ model.RedeemedLoyaltyPointsAmount = _priceFormatter.FormatPrice(-redeemedLoyaltyPointsAmount, request.Currency);}//loyalty points to be earned@@ -202,7 +203,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar shippingBaseInclTax = model.RequiresShipping? (await _orderTotalCalculationService.GetShoppingCartShippingTotal(request.Cart, true)).shoppingCartShippingTotal: 0;- var earnLoyaltyPoints = shoppingCartTotalBase.Value - shippingBaseInclTax.Value;+ var earnLoyaltyPoints = shoppingCartTotalBase.Value - shippingBaseInclTax ?? 0;if (earnLoyaltyPoints > 0)model.WillEarnLoyaltyPoints = await _mediator.Send(new CalculateLoyaltyPointsCommand { Customer = request.Customer, Amount = await _currencyService.ConvertToPrimaryStoreCurrency(earnLoyaltyPoints, request.Currency) });}@@ -213,11 +214,11 @@ namespace Grand.Web.Features.Handlers.ShoppingCartvar gcModel = new OrderTotalsModel.GiftVoucher {Id = appliedGiftVoucher.GiftVoucher.Id,CouponCode = appliedGiftVoucher.GiftVoucher.Code,- Amount = _priceFormatter.FormatPrice(-appliedGiftVoucher.AmountCanBeUsed, false)+ Amount = _priceFormatter.FormatPrice(-appliedGiftVoucher.AmountCanBeUsed, request.Currency)};var remainingAmountBase = appliedGiftVoucher.GiftVoucher.GetGiftVoucherRemainingAmount() - appliedGiftVoucher.AmountCanBeUsed;- gcModel.Remaining = _priceFormatter.FormatPrice(remainingAmountBase, false);+ gcModel.Remaining = _priceFormatter.FormatPrice(remainingAmountBase, request.Currency);model.GiftVouchers.Add(gcModel);}diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.csindex 033f1a141..cd48ed77a 100644--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs@@ -157,7 +157,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCartif (!minOrderSubtotalAmountOk){var minOrderSubtotalAmount = await _currencyService.ConvertFromPrimaryStoreCurrency(_orderSettings.MinOrderSubtotalAmount, request.Currency);- model.MinOrderSubtotalWarning = string.Format(_translationService.GetResource("Checkout.MinOrderSubtotalAmount"), _priceFormatter.FormatPrice(minOrderSubtotalAmount, false));+ model.MinOrderSubtotalWarning = string.Format(_translationService.GetResource("Checkout.MinOrderSubtotalAmount"), _priceFormatter.FormatPrice(minOrderSubtotalAmount, request.Currency));}}model.TermsOfServiceOnShoppingCartPage = _orderSettings.TermsOfServiceOnShoppingCartPage;diff --git a/src/Web/Grand.Web/Models/Catalog/ProductOverviewModel.cs b/src/Web/Grand.Web/Models/Catalog/ProductOverviewModel.csindex 9bbf79cda..b90a3cd48 100644--- a/src/Web/Grand.Web/Models/Catalog/ProductOverviewModel.cs+++ b/src/Web/Grand.Web/Models/Catalog/ProductOverviewModel.cs@@ -17,6 +17,7 @@ namespace Grand.Web.Models.CatalogProductAttributeModels = new List<ProductAttributeModel>();ReviewOverviewModel = new ProductReviewOverviewModel();}+public string Name { get; set; }public string ShortDescription { get; set; }public string FullDescription { get; set; }@@ -54,6 +55,7 @@ namespace Grand.Web.Models.Catalogpublic ProductReviewOverviewModel ReviewOverviewModel { get; set; }#region Nested Classes+public class ProductPriceModel : BaseModel{public ProductPriceModel()@@ -66,6 +68,7 @@ namespace Grand.Web.Models.Catalogpublic string CatalogPrice { get; set; }public string Price { get; set; }public double PriceValue { get; set; }+ public bool PriceIncludesTax { get; set; }public string StartPrice { get; set; }public double StartPriceValue { get; set; }public string HighestBid { get; set; }@@ -80,7 +83,6 @@ namespace Grand.Web.Models.Catalogpublic List<ApplyDiscount> AppliedDiscounts { get; set; }public TierPrice PreferredTierPrice { get; set; }-}public class ProductAttributeModel : BaseModel@@ -89,6 +91,7 @@ namespace Grand.Web.Models.Catalog{Values = new List<ProductAttributeValueModel>();}+public string Name { get; set; }public string SeName { get; set; }public string TextPrompt { get; set; }@@ -104,12 +107,16 @@ namespace Grand.Web.Models.CatalogImageSquaresPictureModel = new PictureModel();PictureModel = new PictureModel();}+public string Name { get; set; }+public string ColorSquaresRgb { get; set; }+//picture model is used with "image square" attribute typepublic PictureModel ImageSquaresPictureModel { get; set; }public PictureModel PictureModel { get; set; }}+#endregion}}\ No newline at end of filediff --git a/src/Web/Grand.Web/Models/Orders/MerchandiseReturnModel.cs b/src/Web/Grand.Web/Models/Orders/MerchandiseReturnModel.csindex 1305e0d44..0af87853e 100644--- a/src/Web/Grand.Web/Models/Orders/MerchandiseReturnModel.cs+++ b/src/Web/Grand.Web/Models/Orders/MerchandiseReturnModel.cs@@ -61,7 +61,7 @@ namespace Grand.Web.Models.Orderspublic string AttributeInfo { get; set; }public string UnitPrice { get; set; }-+ public bool IncludingTax { get; set; }public int Quantity { get; set; }[GrandResourceDisplayName("MerchandiseReturns.ReturnReason")]diff --git a/src/Web/Grand.Web/Models/Orders/OrderDetailsModel.cs b/src/Web/Grand.Web/Models/Orders/OrderDetailsModel.csindex 9ff572d69..f31f71068 100644--- a/src/Web/Grand.Web/Models/Orders/OrderDetailsModel.cs+++ b/src/Web/Grand.Web/Models/Orders/OrderDetailsModel.cs@@ -49,7 +49,7 @@ namespace Grand.Web.Models.Orderspublic string PaymentMethodStatus { get; set; }public bool CanRePostProcessPayment { get; set; }public Dictionary<string, object> CustomValues { get; set; }-+ public bool OrderIncludingTax { get; set; }public string OrderSubtotal { get; set; }public string OrderSubTotalDiscount { get; set; }public string OrderShipping { get; set; }@@ -91,6 +91,7 @@ namespace Grand.Web.Models.Orderspublic string ProductSeName { get; set; }public PictureModel Picture { get; set; }public string UnitPrice { get; set; }+ public bool UnitPriceIncludingTax { get; set; }public double UnitPriceValue { get; set; }public string UnitPriceWithoutDiscount { get; set; }public double UnitPriceWithoutDiscountValue { get; set; }diff --git a/src/Web/Grand.Web/Models/ShoppingCart/AddToCartModel.cs b/src/Web/Grand.Web/Models/ShoppingCart/AddToCartModel.csindex 399bb67e7..91285bc4a 100644--- a/src/Web/Grand.Web/Models/ShoppingCart/AddToCartModel.cs+++ b/src/Web/Grand.Web/Models/ShoppingCart/AddToCartModel.cs@@ -26,6 +26,7 @@ namespace Grand.Web.Models.ShoppingCartpublic int TotalItems { get; set; }public string SubTotal { get; set; }+ public bool SubTotalIncludingTax { get; set; }public string SubTotalDiscount { get; set; }public double DecimalSubTotal { get; set; }diff --git a/src/Web/Grand.Web/Models/ShoppingCart/MiniShoppingCartModel.cs b/src/Web/Grand.Web/Models/ShoppingCart/MiniShoppingCartModel.csindex d627ea034..a5b099657 100644--- a/src/Web/Grand.Web/Models/ShoppingCart/MiniShoppingCartModel.cs+++ b/src/Web/Grand.Web/Models/ShoppingCart/MiniShoppingCartModel.cs@@ -13,6 +13,7 @@ namespace Grand.Web.Models.ShoppingCartpublic IList<ShoppingCartItemModel> Items { get; set; }public int TotalProducts { get; set; }public string SubTotal { get; set; }+ public bool SubTotalIncludingTax { get; set; }public bool DisplayShoppingCartButton { get; set; }public bool DisplayCheckoutButton { get; set; }public bool CurrentCustomerIsGuest { get; set; }diff --git a/src/Web/Grand.Web/Models/ShoppingCart/OrderTotalsModel.cs b/src/Web/Grand.Web/Models/ShoppingCart/OrderTotalsModel.csindex fb955b9fb..4384e3ed8 100644--- a/src/Web/Grand.Web/Models/ShoppingCart/OrderTotalsModel.cs+++ b/src/Web/Grand.Web/Models/ShoppingCart/OrderTotalsModel.cs@@ -13,6 +13,7 @@ namespace Grand.Web.Models.ShoppingCartpublic bool IsEditable { get; set; }public string SubTotal { get; set; }+ public bool SubTotalIncludingTax { get; set; }public double SubTotalValue { get; set; }public string SubTotalDiscount { get; set; }