@inherits ViewModelTemplate @using System.Globalization @using System.Linq @using Dynamicweb.Rendering @using Dynamicweb.Ecommerce.Frontend @using Dynamicweb.Ecommerce.Orders @using Dynamicweb.Ecommerce.ProductCatalog

@Translate("Order Details Cheat Sheet")

@Translate("Hover over text for more details")

@Translate("Order ID"): @Model.Id

@foreach (var orderline in Model.OrderLines) { ProductViewModelSettings productSetting = new ProductViewModelSettings { LanguageId = orderline.ProductLanguageId, CurrencyCode = Model.Price.CurrencyCode, CountryCode = Model.DeliveryCountryCode, ShopId = Model.ShopId }; var isDiscount = IsProductDiscountOrderline(orderline); var rowCssClass = isDiscount ? "bg-secondary text-white" : IsTaxOrderline(orderline) ? "bg-light text-dark" : "bg-primary text-white"; }
@Translate("Name") @Translate("Qty") @Translate("Unit price") @Translate("Total price")
@Translate("Without Discount") @Translate("Discount") @Translate("With Discount / Price") @Translate("Without Discount") @Translate("Discount") @Translate("With Discount / Price")
@RenderOrderlineName(orderline) @orderline.Quantity @RenderOrderlineUnitPriceWithoutDiscount(orderline) @RenderOrderlineUnitDiscount(orderline) @RenderOrderlineUnitPriceWithDiscount(orderline) @RenderOrderlineTotalPriceWithoutDiscount(orderline) @RenderOrderlineTotalDiscount(orderline) @RenderOrderlineTotalPriceWithDiscount(orderline)
@Translate("Total of original price / Total product discounts / Total with all product discounts*")
@Translate("*Price after product discounts, before order discounts, fees and taxes")
How to get the total price of orderlines without order discounts, product discounts nor tax orderlines? 😒 @Translate("Missing in ViewModel") @RenderPrices(Model.TotalProductDiscount, "Model.TotalProductDiscount") @RenderPrices(Model.PriceBeforeFees, "Model.PriceBeforeFees") How to get the total price of orderlines with product discounts, without tax orderlines? 😒
@Translate("Order discount total")
@Translate("Sum of all order discounts (inclusive and exclusive)")
(Model.TotalOrderDiscount)
@RenderPrices(Model.TotalOrderDiscount, "Model.TotalOrderDiscount")
@Translate("Sub totals")
@Translate("Sum of all original prices, discounts and discounted price. Before fees and taxes")
(Model.TotalPriceBeforeFeesAndTaxes)
@RenderPrices("Ecom:Order.TotalPriceWithoutDiscountsFeesAndTaxes") @RenderPrices(Model.TotalDiscount, "Model.TotalDiscount") @RenderPrices(Model.TotalPriceBeforeFeesAndTaxes, "Model.TotalPriceBeforeFeesAndTaxes")
@Translate("Payment")
@Model.PaymentMethod.Id
@RenderPrices(Model.PaymentFee, "Model.PaymentFee")
@Translate("Shipping")
@Model.ShippingMethod.Id
@RenderPrices(Model.ShippingFee, "Model.ShippingFee")
@Translate("Taxes")
(Model.TotalTaxes)
@RenderPrices(Model.TotalTaxes, "Model.TotalTaxes")
@Translate("Total")
(Model.Price)
@RenderPrices(Model.Price, "Model.Price")
@Translate("Product orderline") @Translate("Discount orderline") @Translate("Tax orderline") @Translate("Product discount price") @Translate("Order discount price") @Translate("Product price - with or without discount") @Translate("Subtotals of product prices, discounts and product prices with discount - before any fees") @Translate("Total order price with discounts, vat, taxes, fees and all.")

@Translate("Billing Address")

@RenderTableRow(Model.CustomerName, "Model.CustomerName") @RenderTableRow(Model.CustomerFirstName, "Model.CustomerFirstName") @RenderTableRow(Model.CustomerMiddleName, "Model.CustomerMiddleName") @RenderTableRow(Model.CustomerSurname, "Model.CustomerSurname") @RenderTableRow(Model.CustomerInitials, "Model.CustomerInitials") @RenderTableRow(Model.CustomerTitle, "Model.CustomerTitle") @RenderTableRow(Model.CustomerPrefix, "Model.CustomerPrefix") @RenderTableRow(Model.CustomerAddress, "Model.CustomerAddress") @RenderTableRow(Model.CustomerAddress2, "Model.CustomerAddress2") @RenderTableRow(Model.CustomerHouseNumber, "Model.CustomerHouseNumber") @RenderTableRow(Model.CustomerCity, "Model.CustomerCity") @RenderTableRow(Model.CustomerRegion, "Model.CustomerRegion") @RenderTableRow(Model.CustomerZip, "Model.CustomerZip") @RenderTableRow(Model.CustomerCountry, "Model.CustomerCountry") @RenderTableRow(Model.CustomerCountryCode, "Model.CustomerCountryCode") @RenderTableRow(Model.CustomerCompany, "Model.CustomerCompany") @RenderTableRow(Model.CustomerEmail, "Model.CustomerEmail") @RenderTableRow(Model.CustomerPhone, "Model.CustomerPhone") @RenderTableRow(Model.CustomerCell, "Model.CustomerCell") @RenderTableRow("Customer.Fax")

@Translate("Shipping/Delivery Address")

@RenderTableRow(Model.DeliveryName, "Model.DeliveryName") @RenderTableRow(Model.DeliveryFirstName, "Model.DeliveryFirstName") @RenderTableRow(Model.DeliveryMiddleName, "Model.DeliveryMiddleName") @RenderTableRow(Model.DeliverySurname, "Model.DeliverySurname") @RenderTableRow(Model.DeliveryInitials, "Model.DeliveryInitials") @RenderTableRow(Model.DeliveryTitle, "Model.DeliveryTitle") @RenderTableRow(Model.DeliveryPrefix, "Model.DeliveryPrefix") @RenderTableRow(Model.DeliveryAddress, "Model.DeliveryAddress") @RenderTableRow(Model.DeliveryAddress2, "Model.DeliveryAddress2") @RenderTableRow(Model.DeliveryHouseNumber, "Model.DeliveryHouseNumber") @RenderTableRow(Model.DeliveryCity, "Model.DeliveryCity") @RenderTableRow(Model.DeliveryRegion, "Model.DeliveryRegion") @RenderTableRow(Model.DeliveryZip, "Model.DeliveryZip") @RenderTableRow(Model.DeliveryCountry, "Model.DeliveryCountry") @RenderTableRow(Model.DeliveryCountryCode, "Model.DeliveryCountryCode") @RenderTableRow(Model.DeliveryCompany, "Model.DeliveryCompany") @RenderTableRow(Model.DeliveryEmail, "Model.DeliveryEmail") @RenderTableRow(Model.DeliveryPhone, "Model.DeliveryPhone") @RenderTableRow(Model.DeliveryCell, "Model.DeliveryCell") @RenderTableRow("Delivery.Fax")

@Translate("Payment method")

@Translate("Icon") @Translate("Name") @Translate("Price") @Translate("Terms")
@if (!string.IsNullOrEmpty(Model.PaymentMethod.Icon) && !Model.PaymentMethod.Icon.Equals("/Files")) { }
@Model.PaymentMethod.Name - @Model.PaymentMethod.Id
@Translate("Description"): @Model.PaymentMethod.Description
@Translate("Code"): @Model.PaymentMethod.Code
@RenderPrices(Model.PaymentFee, "Model.PaymentFee") @Translate("Code"): @Model.PaymentMethod.TermsCode
@Translate("Description"): @Model.PaymentMethod.TermsDescription

@Translate("Shipping method")

@Translate("Icon") @Translate("Name") @Translate("Price") @Translate("FreeFeeAmount") @Translate("PriceOverMaxWeight") @Translate("Agent")
@if (!string.IsNullOrEmpty(Model.ShippingMethod.Icon) && !Model.ShippingMethod.Icon.Equals("/Files")) { }
@Model.ShippingMethod.Name - @Model.ShippingMethod.Id
@Translate("Description"): @Model.ShippingMethod.Description
@Translate("Code"): @Model.ShippingMethod.Code
@RenderPrices(Model.ShippingFee, "Model.ShippingFee") @Model.ShippingMethod.FreeFeeAmount @Model.ShippingMethod.PriceOverMaxWeight @Translate("Name"): @Model.ShippingMethod.AgentName
@Translate("Code"): @Model.ShippingMethod.AgentCode
@Translate("Service Code"): @Model.ShippingMethod.AgentServiceCode
@Translate("Service Description"): @Model.ShippingMethod.AgentServiceDescription

@Translate("Payment Transaction Info")

@RenderTableRow(Model.TransactionCardnumber, "Model.TransactionCardnumber") @RenderTableRow(Model.TransactionCardType, "Model.TransactionCardType") @RenderTableRow(Model.TransactionNumber, "Model.TransactionNumber") @RenderTableRow(Model.TransactionStatus, "Model.TransactionStatus")

@Translate("Track & Trace")

@Translate("TrackTraceName") @Translate("TrackTraceNumber") @Translate("TrackTraceUrl")
@Model.TrackAndTraceName @Model.TrackAndTraceNumber @Model.TrackAndTraceURL

@Translate("Standard fields")

@RenderTableRow(Model.Id, "Model.Id") @RenderTableRow(Model.IntegrationOrderId, "Model.IntegrationOrderId") @RenderTableRow(Model.CustomerUserId, "Model.CustomerUserId") @RenderTableRow("Customer.AccessUserUserName") @RenderTableRow(Model.SecondaryUserId, "Model.SecondaryUserId") @RenderTableRow(Model.SecondaryUserName, "Model.SecondaryUserName") @RenderTableRow(Model.Reference, "Model.Reference") @RenderTableRow(Model.ShopId, "Model.ShopId") @RenderTableRow(Model.StateId, "Model.StateId") @RenderTableRow(Model.StateName, "Model.StateName") @RenderTableRow(Model.StateDescription, "Model.StateDescription") @RenderTableRow(Model.DisplayName, "Model.DisplayName") @RenderTableRow("SavedCardName")
@Translate("SystemName") @Translate("Value")
@RenderTableRow(Model.CreatedAt, "Model.CreatedAt") @RenderTableRow(Model.Modified, "Model.Modified") @RenderTableRow(Model.CompletedDate, "Model.CompletedDate") @RenderTableRow(Model.ShippingDate, "Model.ShippingDate") @RenderTableRow("Delivery.isPickupPoint") @RenderTableRow("Comment") @RenderTableRow(Model.CustomerComment, "Model.CustomerComment") @RenderTableRow("IsBasedOnRecurringOrder") @RenderTableRow("IsRecurringOrder") @RenderTableRow(Model.RecurringOrderId, "Model.RecurringOrderId") @RenderTableRow("PointsToUse") @RenderTableRow("RewardTotalPoints") @RenderTableRow("TotalPoints")
@Translate("SystemName") @Translate("Value")
@RenderTableRow(Model.Volume, "Model.Volume") @RenderTableRow(Model.Weight, "Model.Weight") @RenderTableRow(Model.CustomerAccepted, "Model.CustomerAccepted") @RenderTableRow(Model.CustomerEan, "Model.CustomerEan") @RenderTableRow(Model.CustomerRefId, "Model.CustomerRefId") @RenderTableRow("Customer.VatRegNumber") @RenderTableRow("ExternalFee") @RenderTableRow("Requisition") @RenderTableRow(Model.VoucherCode, "Model.VoucherCode") @RenderTableRow("GifTCardCode")
@Translate("SystemName") @Translate("Value")

@Translate("Custom fields")

@{ foreach (var field in Model.OrderFields) { var orderFieldValue = field.Value?.Value?.ToString() ?? ""; } }
@Translate("Name") @Translate("SystemName") @Translate("Type") @Translate("Value")
@field.Value.Name @field.Value.SystemName @field.Value.Type @orderFieldValue
@helper RenderPrices(PriceViewModel price, string prefix) { var isPriceZero = price.Price == 0.00;
@price.PriceFormatted @RenderPriceLine(prefix, "ShowPricesWithVat", price.ShowPricesWithVat.ToString()) @RenderPriceLine(prefix, "PriceWithoutVatFormatted", price.PriceWithoutVatFormatted, "PriceWithoutVat", price.PriceWithoutVat) @RenderPriceLine(prefix, "PriceWithVatFormatted", price.PriceWithVatFormatted, "PriceWithVat", price.PriceWithVat) @RenderPriceLine(prefix, "VatFormatted", price.VatFormatted, "Vat", price.Vat) @RenderPriceLine(prefix, "VATPercentFormatted", price.VATPercentFormatted, "VATPercent", price.VATPercent)
} @helper RenderPriceLine(string prefix, string formattedPropertyName, string formattedPropertyValue, string propertyName = null, double propertyValue = default) { var title = $"{prefix}.{formattedPropertyName} = {formattedPropertyValue}"; if (!string.IsNullOrEmpty(propertyName)) { title += $"\n{prefix}.{propertyName} = {propertyValue.ToString(CultureInfo.InvariantCulture)}"; }
@formattedPropertyName: @formattedPropertyValue } @helper RenderTableRow(object propertyValue, string propertyName) { var value = propertyValue != null ? propertyValue.ToString() : ""; @propertyName @value } @helper RenderPrices(string tag) { var title = $"GetString(\'{tag}')";
@Translate("Missing in ViewModel")
} @helper RenderTableRow(string propertyValue) { @($"GetString(\"Ecom:Order.{propertyValue}\")") @Translate("Missing in ViewModel") } @helper RenderOrderlineName(OrderLineViewModel orderline) { //var innerPadding = !string.IsNullOrEmpty(orderline.ParentOrderlineId) ? "ps-4" : ""; // Missing property in ViewModel for ParentOrderId var innerPadding = "";
@if (IsDiscountOrderline(orderline)) { @Translate("DISCOUNT"): } @orderline.ProductName @if (!string.IsNullOrEmpty(orderline.ProductNumber)) { var productNumber = orderline.ProductNumber; if (!string.IsNullOrEmpty(orderline.ProductVariantName)) { productNumber += $" - {orderline.ProductVariantName}"; }
@productNumber }
@Translate("Orderline type"): @orderline.OrderLineType (@orderline.OrderLineType.GetHashCode())
@Translate("Orderline Id"): @orderline.Id
@Translate("ParentOrderlineId missing in ViewModel")
} @helper RenderOrderlineUnitPriceWithoutDiscount(OrderLineViewModel orderline) { if (IsDiscountOrderline(orderline) || IsTaxOrderline((orderline))) { @Translate("Same as") @Translate("With Discount / Price") } else { @RenderPrices(orderline.UnitPriceBeforeDiscount, "OrderLineViewModel orderline.UnitPriceBeforeDiscount") We cannot tell if there are product discount orderlines associated with this one 😒 } } @helper RenderOrderlineUnitDiscount(OrderLineViewModel orderline) { if (IsDiscountOrderline(orderline) || IsTaxOrderline((orderline))) { @Translate("Not applicable") } else { @Translate("Missing in ViewModel"). We cannot tell if there are product discount orderlines associated with this one 😒 } } @helper RenderOrderlineUnitPriceWithDiscount(OrderLineViewModel orderline) { @RenderPrices(orderline.UnitPrice, "OrderLineViewModel orderline.UnitPrice") } @helper RenderOrderlineTotalPriceWithoutDiscount(OrderLineViewModel orderline) { if (IsDiscountOrderline(orderline) || IsTaxOrderline(orderline)) { @Translate("Same as") @Translate("With Discount / Price") } else { @RenderPrices("Ecom:Order:OrderLine.Price") We cannot tell if there are product discount orderlines associated with this one 😒 } } @helper RenderOrderlineTotalDiscount(OrderLineViewModel orderline) { if (IsDiscountOrderline(orderline) || IsTaxOrderline(orderline)) { @Translate("Not applicable") } else { @RenderPrices(orderline.TotalDiscount, "OrderLineViewModel orderline.TotalDiscount") We cannot tell if there are product discount orderlines associated with this one 😒 } } @helper RenderOrderlineTotalPriceWithDiscount(OrderLineViewModel orderline) { @RenderPrices(orderline.Price, "OrderLineViewModel orderline.Price") } @functions { public static bool IsDiscountOrderline(OrderLineViewModel orderline) { return IsOrderDiscountOrderline(orderline) || IsProductDiscountOrderline(orderline); } public static bool IsOrderDiscountOrderline(OrderLineViewModel orderline) { return orderline.OrderLineType == OrderLineType.Discount; } public static bool IsProductDiscountOrderline(OrderLineViewModel orderline) { return orderline.OrderLineType == OrderLineType.ProductDiscount; } public static bool IsTaxOrderline(OrderLineViewModel orderline) { return orderline.OrderLineType == OrderLineType.Tax; } }