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.

MessageTemplate - OrderItem - add new tokens ShipQty/CancelQty/IsShipEnabled, remove ShowSkuOnProductDetailsPage

KrzysztofPajak779905efd33e
diff --git a/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidOrderItem.cs b/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidOrderItem.cs
index 38356e15a..6783e5e26 100644
--- a/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidOrderItem.cs
+++ b/src/Business/Grand.Business.Messages/DotLiquidDrops/LiquidOrderItem.cs
@@ -1,7 +1,6 @@
using DotLiquid;
using Grand.Business.Common.Extensions;
using Grand.Domain.Catalog;
-using Grand.Domain.Directory;
using Grand.Domain.Localization;
using Grand.Domain.Orders;
using Grand.Domain.Stores;
@@ -15,18 +14,16 @@ namespace Grand.Business.Messages.DotLiquidDrops
public partial class LiquidOrderItem : Drop
{
private OrderItem _orderItem;
- private Order _order;
private Product _product;
private Language _language;
private Store _store;
private Vendor _vendor;
- public LiquidOrderItem(OrderItem orderItem, Product product, Order order, Language language, Currency currency, Store store, Vendor vendor)
+ public LiquidOrderItem(OrderItem orderItem, Product product, Language language, Store store, Vendor vendor)
{
_orderItem = orderItem;
_store = store;
_language = language;
- _order = order;
_product = product;
_vendor = vendor;
AdditionalTokens = new Dictionary<string, string>();
@@ -36,47 +33,34 @@ namespace Grand.Business.Messages.DotLiquidDrops
public string TotalPrice { get; set; }
-
public string ProductSku { get; set; }
-
- public bool ShowSkuOnProductDetailsPage { get; set; }
-
public bool IsDownloadAllowed { get; set; }
public bool IsLicenseDownloadAllowed { get; set; }
- public string DownloadUrl
- {
- get
- {
- var storeId = _order?.StoreId;
+ public string DownloadUrl {
+ get {
string downloadUrl = string.Format("{0}/download/getdownload/{1}", (_store.SslEnabled ? _store.SecureUrl.Trim('/') : _store.Url.Trim('/')), _orderItem.OrderItemGuid);
return downloadUrl;
}
}
- public string LicenseUrl
- {
- get
- {
+ public string LicenseUrl {
+ get {
string licenseUrl = string.Format("{0}/download/getlicense/{1}", (_store.SslEnabled ? _store.SecureUrl.Trim('/') : _store.Url.Trim('/')), _orderItem.OrderItemGuid);
return licenseUrl;
}
}
- public Guid OrderItemGuid
- {
- get
- {
+ public Guid OrderItemGuid {
+ get {
return _orderItem.OrderItemGuid;
}
}
- public string ProductName
- {
- get
- {
+ public string ProductName {
+ get {
string name = "";
if (_product != null)
@@ -86,10 +70,8 @@ namespace Grand.Business.Messages.DotLiquidDrops
}
}
- public string ProductSeName
- {
- get
- {
+ public string ProductSeName {
+ get {
string name = "";
if (_product != null)
@@ -97,10 +79,8 @@ namespace Grand.Business.Messages.DotLiquidDrops
return name;
}
}
- public string ProductShortDescription
- {
- get
- {
+ public string ProductShortDescription {
+ get {
string desc = "";
if (_product != null)
@@ -110,10 +90,8 @@ namespace Grand.Business.Messages.DotLiquidDrops
}
}
- public string ProductFullDescription
- {
- get
- {
+ public string ProductFullDescription {
+ get {
string desc = "";
if (_product != null)
@@ -127,186 +105,157 @@ namespace Grand.Business.Messages.DotLiquidDrops
- public string ProductId
- {
- get
- {
+ public string ProductId {
+ get {
return _orderItem.ProductId;
}
}
- public string VendorId
- {
- get
- {
+ public string VendorId {
+ get {
return _orderItem.VendorId;
}
}
- public string VendorName
- {
- get
- {
+ public string VendorName {
+ get {
return _vendor?.Name;
}
}
- public string WarehouseId
- {
- get
- {
+ public string WarehouseId {
+ get {
return _orderItem.WarehouseId;
}
}
- public int Quantity
- {
- get
- {
+ public int Quantity {
+ get {
return _orderItem.Quantity;
}
}
- public int OpenQty
- {
- get
- {
+ public int OpenQty {
+ get {
return _orderItem.OpenQty;
}
}
- public double UnitPriceWithoutDiscInclTax
- {
- get
- {
+ public int CancelQty {
+ get {
+ return _orderItem.CancelQty;
+ }
+ }
+ public int ShipQty {
+ get {
+ return _orderItem.ShipQty;
+ }
+ }
+
+ public bool IsShipEnabled {
+ get {
+ return _orderItem.IsShipEnabled;
+ }
+ }
+
+ public double UnitPriceWithoutDiscInclTax {
+ get {
return _orderItem.UnitPriceWithoutDiscInclTax;
}
}
- public double UnitPriceWithoutDiscExclTax
- {
- get
- {
+ public double UnitPriceWithoutDiscExclTax {
+ get {
return _orderItem.UnitPriceWithoutDiscExclTax;
}
}
- public double UnitPriceInclTax
- {
- get
- {
+ public double UnitPriceInclTax {
+ get {
return _orderItem.UnitPriceInclTax;
}
}
- public double UnitPriceExclTax
- {
- get
- {
+ public double UnitPriceExclTax {
+ get {
return _orderItem.UnitPriceExclTax;
}
}
- public double PriceInclTax
- {
- get
- {
+ public double PriceInclTax {
+ get {
return _orderItem.PriceInclTax;
}
}
- public double PriceExclTax
- {
- get
- {
+ public double PriceExclTax {
+ get {
return _orderItem.PriceExclTax;
}
}
- public double DiscountAmountInclTax
- {
- get
- {
+ public double DiscountAmountInclTax {
+ get {
return _orderItem.DiscountAmountInclTax;
}
}
- public double DiscountAmountExclTax
- {
- get
- {
+ public double DiscountAmountExclTax {
+ get {
return _orderItem.DiscountAmountExclTax;
}
}
- public double OriginalProductCost
- {
- get
- {
+ public double OriginalProductCost {
+ get {
return _orderItem.OriginalProductCost;
}
}
- public string AttributeDescription
- {
- get
- {
+ public string AttributeDescription {
+ get {
return _orderItem.AttributeDescription;
}
}
- public int DownloadCount
- {
- get
- {
+ public int DownloadCount {
+ get {
return _orderItem.DownloadCount;
}
}
- public bool IsDownloadActivated
- {
- get
- {
+ public bool IsDownloadActivated {
+ get {
return _orderItem.IsDownloadActivated;
}
}
- public string LicenseDownloadId
- {
- get
- {
+ public string LicenseDownloadId {
+ get {
return _orderItem.LicenseDownloadId;
}
}
- public double? ItemWeight
- {
- get
- {
+ public double? ItemWeight {
+ get {
return _orderItem.ItemWeight;
}
}
- public DateTime? RentalStartDateUtc
- {
- get
- {
+ public DateTime? RentalStartDateUtc {
+ get {
return _orderItem.RentalStartDateUtc;
}
}
- public DateTime? RentalEndDateUtc
- {
- get
- {
+ public DateTime? RentalEndDateUtc {
+ get {
return _orderItem.RentalEndDateUtc;
}
}
- public DateTime CreatedOnUtc
- {
- get
- {
+ public DateTime CreatedOnUtc {
+ get {
return _orderItem.CreatedOnUtc;
}
}
diff --git a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs
index 10a2b7cd2..962ab03ad 100644
--- a/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs
+++ b/src/Business/Grand.Business.System/Commands/Handlers/Messages/GetOrderTokensCommandHandler.cs
@@ -38,7 +38,6 @@ namespace Grand.Business.System.Commands.Handlers.Messages
private readonly ITranslationService _translationService;
private readonly IGiftVoucherService _giftVoucherService;
- private readonly CatalogSettings _catalogSettings;
private readonly TaxSettings _taxSettings;
public GetOrderTokensCommandHandler(
@@ -53,7 +52,6 @@ namespace Grand.Business.System.Commands.Handlers.Messages
IPaymentService paymentService,
ITranslationService translationService,
IGiftVoucherService giftVoucherService,
- CatalogSettings catalogSettings,
TaxSettings taxSettings)
{
_languageService = languageService;
@@ -67,7 +65,6 @@ namespace Grand.Business.System.Commands.Handlers.Messages
_paymentService = paymentService;
_translationService = translationService;
_giftVoucherService = giftVoucherService;
- _catalogSettings = catalogSettings;
_taxSettings = taxSettings;
}
@@ -81,7 +78,7 @@ namespace Grand.Business.System.Commands.Handlers.Messages
{
var product = await _productService.GetProductById(item.ProductId);
Vendor vendorItem = string.IsNullOrEmpty(item.VendorId) ? null : await _vendorService.GetVendorById(item.VendorId);
- var liqitem = new LiquidOrderItem(item, product, request.Order, language, currency, request.Store, vendorItem);
+ var liqitem = new LiquidOrderItem(item, product, language, request.Store, vendorItem);
#region Download
@@ -127,7 +124,6 @@ namespace Grand.Business.System.Commands.Handlers.Messages
sku = product.FormatSku(item.Attributes, _productAttributeParser);
liqitem.ProductSku = WebUtility.HtmlEncode(sku);
- liqitem.ShowSkuOnProductDetailsPage = _catalogSettings.ShowSkuOnProductDetailsPage;
liqitem.ProductOldPrice = _priceFormatter.FormatPrice(product.OldPrice, currency, language, true);
liquidOrder.OrderItems.Add(liqitem);
@@ -149,7 +145,7 @@ namespace Grand.Business.System.Commands.Handlers.Messages
Dictionary<string, string> dict = new Dictionary<string, string>();
foreach (var item in request.Order.OrderTaxes)
{
- string taxRate = string.Format(_translationService.GetResource("Messages.Order.TaxRateLine"), _priceFormatter.FormatTaxRate(item.Percent));
+ string taxRate = string.Format(_translationService.GetResource("Messages.Order.TaxRateLine", language.Id), _priceFormatter.FormatTaxRate(item.Percent));
string taxValue = _priceFormatter.FormatPrice(item.Amount, currency, language, false);
dict.Add(taxRate, taxValue);
}
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataMessageTemplates.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataMessageTemplates.cs
index 9221141d4..af4ed692f 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataMessageTemplates.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataMessageTemplates.cs
@@ -37,7 +37,7 @@ namespace Grand.Business.System.Services.Installation
{{item.AttributeDescription}}
{% endif %}
- {% if item.ShowSkuOnProductDetailsPage and item.ProductSku != null and item.ProductSku != '' %}
+ {% if item.ProductSku != null and item.ProductSku != '' %}
<br />
Sku: {{item.ProductSku}}
{% endif %}
@@ -115,7 +115,7 @@ namespace Grand.Business.System.Services.Installation
{{item.AttributeDescription}}
{% endif %}
- {% if item.ShowSkuOnProductDetailsPage and item.ProductSku != null and item.ProductSku != '' %}
+ {% if item.ProductSku != null and item.ProductSku != '' %}
<br />
Sku: {{item.ProductSku}}
{% endif %}
@@ -150,7 +150,7 @@ namespace Grand.Business.System.Services.Installation
{{item.AttributeDescription}}
{% endif %}
- {% if item.ShowSkuOnProductDetailsPage and item.ProductSku != null and item.ProductSku != '' %}
+ {% if item.ProductSku != null and item.ProductSku != '' %}
<br />
Sku: {{item.ProductSku}}
{% endif %}