Skip to content

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.

ProductAttributeFormatter.cs - remove translationService

support61ee01bca43e
diff --git a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
index dcb7bf720..538421149 100644
--- a/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Products/ProductAttributeFormatter.cs
@@ -2,7 +2,6 @@ using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Catalog.Prices;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Catalog.Tax;
-using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Customers;
@@ -20,7 +19,6 @@ namespace Grand.Business.Catalog.Services.Products
{
private readonly IWorkContext _workContext;
private readonly IProductAttributeService _productAttributeService;
- private readonly ITranslationService _translationService;
private readonly ITaxService _taxService;
private readonly IPriceFormatter _priceFormatter;
private readonly IPricingService _pricingService;
@@ -28,7 +26,6 @@ namespace Grand.Business.Catalog.Services.Products
public ProductAttributeFormatter(IWorkContext workContext,
IProductAttributeService productAttributeService,
- ITranslationService translationService,
ITaxService taxService,
IPriceFormatter priceFormatter,
IPricingService priceCalculationService,
@@ -36,7 +33,6 @@ namespace Grand.Business.Catalog.Services.Products
{
_workContext = workContext;
_productAttributeService = productAttributeService;
- _translationService = translationService;
_taxService = taxService;
_priceFormatter = priceFormatter;
_pricingService = priceCalculationService;
@@ -133,13 +129,11 @@ namespace Grand.Business.Catalog.Services.Products
out var giftVoucherSenderName, out var giftVoucherSenderEmail, out _);
//sender
- var giftVoucherFrom = product.GiftVoucherTypeId == GiftVoucherType.Virtual ?
- string.Format(_translationService.GetResource("GiftVoucherAttribute.From.Virtual"), giftVoucherSenderName, giftVoucherSenderEmail) :
- string.Format(_translationService.GetResource("GiftVoucherAttribute.From.Physical"), giftVoucherSenderName);
+ var giftVoucherFrom = product.GiftVoucherTypeId == GiftVoucherType.Virtual
+ ? $"{giftVoucherSenderName} <{giftVoucherSenderEmail}>" : $"{giftVoucherSenderName}";
//recipient
- var giftVoucherFor = product.GiftVoucherTypeId == GiftVoucherType.Virtual ?
- string.Format(_translationService.GetResource("GiftVoucherAttribute.For.Virtual"), giftVoucherRecipientName, giftVoucherRecipientEmail) :
- string.Format(_translationService.GetResource("GiftVoucherAttribute.For.Physical"), giftVoucherRecipientName);
+ var giftVoucherFor = product.GiftVoucherTypeId == GiftVoucherType.Virtual
+ ? $"{giftVoucherRecipientName} <{giftVoucherRecipientEmail}>" : $"{giftVoucherRecipientName}";
//encode (if required)
if (htmlEncode)
diff --git a/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs b/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs
index 0899e04c6..ea78eac7f 100644
--- a/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs
+++ b/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs
@@ -51,10 +51,10 @@ namespace Grand.Domain.Orders
customAttributes = new List<CustomAttribute>();
recipientName = customAttributes.FirstOrDefault(x => x.Key == "RecipientName")?.Value;
- recipientEmail = customAttributes.FirstOrDefault(x => x.Key == "RecipientEmail")?.Value; ;
- senderName = customAttributes.FirstOrDefault(x => x.Key == "SenderName")?.Value; ;
- senderEmail = customAttributes.FirstOrDefault(x => x.Key == "SenderEmail")?.Value; ;
- giftVoucherMessage = customAttributes.FirstOrDefault(x => x.Key == "Message")?.Value; ;
+ recipientEmail = customAttributes.FirstOrDefault(x => x.Key == "RecipientEmail")?.Value;
+ senderName = customAttributes.FirstOrDefault(x => x.Key == "SenderName")?.Value;
+ senderEmail = customAttributes.FirstOrDefault(x => x.Key == "SenderEmail")?.Value;
+ giftVoucherMessage = customAttributes.FirstOrDefault(x => x.Key == "Message")?.Value;
}