Table of Contents

Class VariantInfoViewModel

Namespace
Dynamicweb.Ecommerce.ProductCatalog
Assembly
Dynamicweb.Ecommerce.dll

Represents the view model for displaying product variant information. This model is used to build a hierarchical tree of variant options and to calculate pricing and stock levels.

public class VariantInfoViewModel : FillableViewModelBase
Inheritance
VariantInfoViewModel
Inherited Members

Remarks

For example, consider a product that is available in multiple colors and sizes. In this 2-level variant structure, the first level represents the color options, while the second level represents the size options. Each color node acts as a parent variant with its unique price and stock level. All size variants (the children of a color node) share the same price and stock as defined by their parent color node.

In practice:

  • The color variant (parent) holds the specific price and stock information applicable for that color. For instance, a "Red" variant might be priced at $29.99 with a total stock of 50 units across all sizes.

  • The size variants (children) under the "Red" color simply represent the available sizes (e.g., Small, Medium, Large). The stock for the color variant is aggregated from all its size options, so each size contains stock information for that specific color and size combination.

  • The MinPrice and MaxPrice properties are calculated based on the child variants, allowing for a clear representation of the price range for that color.

  • The Stock property is calculated by summing the stock levels of all child variants, providing a total stock count for that color.

This hierarchical design allows for flexible handling of variant information, making it easy to represent both simple single-level variants as well as more complex multi-level structures where parent nodes dictate common properties for their child nodes.

Properties

Image

Gets or sets the image for the variant. Uses lazy initialization to defer the creation of the MediaViewModel instance.

public MediaViewModel Image { get; set; }

Property Value

MediaViewModel

OptionColor

Gets or sets the option color.

public string OptionColor { get; set; }

Property Value

string

OptionID

Gets or sets the option identifier.

public string OptionID { get; set; }

Property Value

string

OptionImage

Gets or sets the image for the option.

public MediaViewModel OptionImage { get; set; }

Property Value

MediaViewModel

OptionName

Gets or sets the option name.

public string OptionName { get; set; }

Property Value

string

OptionSort

Gets or sets the sort order of the option.

public int OptionSort { get; set; }

Property Value

int

Price

Gets or sets the price for the variant. Uses lazy initialization to defer the creation of the PriceViewModel instance.

public PriceViewModel Price { get; set; }

Property Value

PriceViewModel

PriceMax

Gets or sets the maximum price for the variant. Uses lazy initialization.

public PriceViewModel PriceMax { get; set; }

Property Value

PriceViewModel

PriceMin

Gets or sets the minimum price for the variant. Uses lazy initialization.

public PriceViewModel PriceMin { get; set; }

Property Value

PriceViewModel

ProductID

Gets or sets the product identifier.

public string ProductID { get; set; }

Property Value

string

ProductName

Gets or sets the product name.

public string ProductName { get; set; }

Property Value

string

ProductNumber

Gets or sets the product number.

public string ProductNumber { get; set; }

Property Value

string

ProductStock

Gets or sets the product stock.

public double ProductStock { get; set; }

Property Value

double

Stock

Gets or sets the stock for the variant. Uses lazy initialization.

public double Stock { get; set; }

Property Value

double

VariantGroupDisplayType

Gets or sets the display type for the variant group.

public VariantGroupDisplayType VariantGroupDisplayType { get; set; }

Property Value

VariantGroupDisplayType

VariantID

Gets or sets the variant identifier.

public string VariantID { get; set; }

Property Value

string

VariantInfo

Gets or sets the child variant information as a list. This property builds a hierarchical tree of variant options, ordered by the sort order.

public List<VariantInfoViewModel> VariantInfo { get; set; }

Property Value

List<VariantInfoViewModel>

VariantInfoGroupDescription

Gets or sets the variant info group description.

public string VariantInfoGroupDescription { get; set; }

Property Value

string

VariantInfoGroupId

Gets or sets the variant info group identifier.

public string VariantInfoGroupId { get; set; }

Property Value

string

VariantInfoGroupName

Gets or sets the variant info group name.

public string VariantInfoGroupName { get; set; }

Property Value

string

Methods

GetParent()

Gets the parent variant information view model.

public VariantInfoViewModel GetParent()

Returns

VariantInfoViewModel

The parent VariantInfoViewModel instance, or null if there is no parent.

To top