Class OrderLineViewModel
- Namespace
- Dynamicweb.Ecommerce.Frontend
- Assembly
- Dynamicweb.Ecommerce.dll
The order line viewmodel represents an orderline and its data. This class holds detailed information about the product, pricing, and other attributes related to an order line.
It contains historic data of the previous price, if changed, as well as properties handling lookup of discounts for the order line as well as relations to parent order line and its order.
If multiple of the properties with performance overhead are used on the order line list and many order lines are listed, a lot of data will be loaded and affect performance. Limit the use of the properties with performance overhead on lists or use the web-api to load additional information on demand when needed.
public class OrderLineViewModel : FillableViewModelBase
- Inheritance
-
OrderLineViewModel
- Inherited Members
- Extension Methods
Remarks
A number of extension methods exists for the order line viewmodel giving access to additional functionality or loading data in other structures. To see these extension methods in your template, add Dynamicweb.Ecommerce.Frontend in a using statement.
Properties
BomOrderLines
The list of order lines representing the BOM for this product, detailing components or child products on different order lines.
public IList<OrderLineViewModel> BomOrderLines { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
Comment
A comment or note associated with the order line.
public string Comment { get; set; }
Property Value
Remarks
Eager loaded - always available and using it does not come with an overhead
Id
The order line id
public string Id { get; set; }
Property Value
- string
I.e. 'OL12345'
Remarks
Eager loaded - always available and using it does not come with an overhead
OrderId
The id of the order to which this order line belongs.
public string OrderId { get; set; }
Property Value
- string
I.e. 'ORDER493'
Remarks
Eager loaded - always available and using it does not come with an overhead
OrderLineFields
A dictionary of custom fields associated with this order line.
public Dictionary<string, FieldValueViewModel> OrderLineFields { get; set; }
Property Value
- Dictionary<string, FieldValueViewModel>
An dictionary of FieldValueViewModel where the key is the system name of the field
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
OrderLineType
The type of the order line, which can indicate if it's a product, discount, point product, etc.
public OrderLineType? OrderLineType { get; set; }
Property Value
Remarks
Eager loaded - always available and using it does not come with an overhead
ParentLineId
The id for the parent order line, only set if this order line is a child of another order line.
public string ParentLineId { get; set; }
Property Value
- string
I.e. 'OL12345'
Remarks
Eager loaded - always available and using it does not come with an overhead
Points
If the OrderLineType is PointProduct this says the amount of points needed for the order line, as it's UnitPoints * Quantity, rounded up.
public double Points { get; set; }
Property Value
- double
I.e 15
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
Price
The price information for this order line, encapsulating the base price without adjustments, it's calculated as Quantity * UnitPrice.
public PriceViewModel Price { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
PrimaryOrDefaultGroup
The primary or default group information for the product, used for categorization or grouping in the frontend.
It's a view that's being created based on the GroupInfoSettings with the default group found by the attached product.
public GroupInfoViewModel PrimaryOrDefaultGroup { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
ProductId
The id of the product associated with this order line, used as a key to find a unique product.
public string ProductId { get; set; }
Property Value
- string
I.e. 'PROD1'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
ProductImage
The path to the primary image representing the product.
This path is found by looking at all the ImagePatternImages and selecting the default image.
If theres no images in the related products ImagePatternImages, it will look for a "Missing image" in your GlobalSettings.config at "/Globalsettings/Ecom/Picture/NoPicture/Large".
public string ProductImage { get; set; }
Property Value
- string
I.e. '/Files/Images/missing_image.jpg'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
ProductLanguageId
The language identifier for the product, used as a key to find a unique product.
public string ProductLanguageId { get; set; }
Property Value
- string
I.e. 'LANG1'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
ProductName
The name of the product.
Stored specifically on the order line to know the name of the product from when the order line was created.
public string ProductName { get; set; }
Property Value
- string
I.e. 'Castelli Logo Bandana'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
ProductNumber
The product number or SKU for the product.
public string ProductNumber { get; set; }
Property Value
- string
I.e. 'SKU123456'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
ProductVariantId
The id of the product variant of the product associated with this order line, used as a key to find a unique product.
If the ProductId is the master product, this will be an empty string.
public string ProductVariantId { get; set; }
Property Value
- string
I.e. 'VO1'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
ProductVariantName
The name of the product variant, if applicable.
Stored specifically on the order line to know the name of the product variant from when the order line was created.
public string ProductVariantName { get; set; }
Property Value
- string
I.e. 'S'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
Quantity
The quantity of the product ordered in this line.
public double Quantity { get; set; }
Property Value
- double
I.e 5
Remarks
Eager loaded - always available and using it does not come with an overhead
Reference
A reference to the URL the product attacahed to the order line is found.
public string Reference { get; set; }
Property Value
- string
I.e '/Default.aspx?ID=150'
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
RewardPoints
The reward points gained from purchasing this order line.
public double RewardPoints { get; set; }
Property Value
- double
I.e 20
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
StockLocationId
The stock location identifier, indicating where the product is stored or will be shipped from.
public long StockLocationId { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
TotalDiscount
The total discount amount for this order line, summarizing all discounts applied.
If OrderLineType is Fixed or Product it will go through all discount order lines on the OrderId and total them.
public PriceViewModel TotalDiscount { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
TotalPriceWithProductDiscounts
The total price for this order line after applying product specific discounts.
If OrderLineType is Fixed or Product, it will add the TotalDiscount to the Price.
public PriceViewModel TotalPriceWithProductDiscounts { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
UnitDiscount
The unit discount, showing the discount amount applied per unit of product.
The calculation for this is TotalDiscount / Quantity as long as quantity is above 0.
public PriceViewModel UnitDiscount { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
UnitId
The id of the unit that the product has been attached to the order line with.
public string UnitId { get; set; }
Property Value
- string
I.e. 'UNIT1'
Remarks
Eager loaded - always available and using it does not come with an overhead
UnitName
The name of the unit of measure for the product that's attached to the order line.
public string UnitName { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
UnitPoints
The points it costs to purchase the product attached to the order line.
It's taken from the value PointPrice rounded up.
public double UnitPoints { get; set; }
Property Value
- double
I.e 25
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
UnitPrice
The unit price information, representing the cost per unit of the product before any discounts.
public PriceViewModel UnitPrice { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
UnitPriceBeforeDiscount
The price of the unit before UnitPrice is changed.
If SetUnitPrice(OrderLine, double, bool, bool) is used and the OrderLineType is not 'Fixed', it will be changed to 'Fixed' and UnitPriceBeforeDiscount will be changed to the original UnitPrice before it was changed.
By default however, this value will be 0, therefore NOT the same as UnitPrice.
public PriceViewModel UnitPriceBeforeDiscount { get; set; }
Property Value
Examples
Initial state;
- UnitPrice = 5 - UnitPriceBeforeDiscount = 0 - OrderLineType = ProductThe UnitPrice is changed through SetUnitPrice(OrderLine, double, bool, bool) with a new value of 10.
The new state will now be;
- UnitPrice = 10 - UnitPriceBeforeDiscount = 5 - OrderLineType = FixedRemarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
UnitPriceWithProductDiscount
The unit price with product specific discounts applied.
If OrderLineType is Fixed or Product, it will add the UnitDiscount to the UnitPrice.
public PriceViewModel UnitPriceWithProductDiscount { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
UnitRewardPoints
The amount of points gained from purchasing a single unit of the product attached to the order line.
public double UnitRewardPoints { get; set; }
Property Value
- double
I.e 30
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
Volume
The volume of the product attached to this order line.
public double Volume { get; set; }
Property Value
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.
Weight
The weight of the product attached to this order line.
public double Weight { get; set; }
Property Value
- double
I.e 10
Remarks
Lazy loaded - only filled when using it. Comes with a performance hit when used.