Table of Contents

Class ProductViewModelExtensions

Namespace
Dynamicweb.Ecommerce.ProductCatalog
Assembly
Dynamicweb.Ecommerce.dll
The class UserExtensions represents shared member providing user extensions.
public static class ProductViewModelExtensions
Inheritance
ProductViewModelExtensions
Inherited Members

Remarks

Be careful about performance when using these extension methods Be careful about circular references when using these extension methods

Methods

BackInStockRegisteredForUser(ProductViewModel, string, long)

public static bool BackInStockRegisteredForUser(this ProductViewModel product, string unitId = "", long stocklocationId = 0)

Parameters

product ProductViewModel
unitId string
stocklocationId long

Returns

bool
Gets the primary link to a given group and that groups primary page id if that is specified - otherwise the specified page id.
public static string GetGroupLink(this GroupInfoViewModel group, int pageId, bool usePrimaryGroupPageId = true)

Parameters

group GroupInfoViewModel
The group to create the link for
pageId int
The pageid that should be used. If a pageid has been specified on the primary group in this shop that the product belongs to, that id will be used instead of the passed pageid.
usePrimaryGroupPageId bool

Returns

string

GetProductDisplayGroupFieldsByGroupSystemNames(ProductViewModel, IEnumerable<string>, bool)

Gets product display group models
public static IEnumerable<FieldGroupViewModel> GetProductDisplayGroupFieldsByGroupSystemNames(this ProductViewModel productModel, IEnumerable<string> groupSystemNames, bool hideZeroValues = false)

Parameters

productModel ProductViewModel
groupSystemNames IEnumerable<string>
hideZeroValues bool

Returns

IEnumerable<FieldGroupViewModel>
Gets the primary link to a given product using its default groupid and that groups primary page id if that is specified - otherwise the specified page id.
public static string GetProductLink(this ProductViewModel product, int pageId, bool usePrimaryGroupPageId = true)

Parameters

product ProductViewModel
The product to create the link for
pageId int
The pageid that should be used. If a pageid has been specified on the primary group in this shop that the product belongs to, that id will be used instead of the passed pageid.
usePrimaryGroupPageId bool
If true, the primary page specified on the product primary group is used instead of the passed pageid

Returns

string

GetProducts(List<ProductInfoViewModel>)

Gets a collection of ProductViewModel for the specified product infos
public static IEnumerable<ProductViewModel> GetProducts(this List<ProductInfoViewModel> productInfo)

Parameters

productInfo List<ProductInfoViewModel>

Returns

IEnumerable<ProductViewModel>

GetRelatedProducts(ProductViewModel)

Gets a collection of ProductViewModel containing all related products from all related groups
public static IEnumerable<ProductViewModel> GetRelatedProducts(this ProductViewModel product)

Parameters

product ProductViewModel

Returns

IEnumerable<ProductViewModel>

GetRelatedProducts(RelatedGroupViewModel)

Gets a collection of ProductViewModel containing all related products of specified related group
public static IEnumerable<ProductViewModel> GetRelatedProducts(this RelatedGroupViewModel relatedGroup)

Parameters

relatedGroup RelatedGroupViewModel

Returns

IEnumerable<ProductViewModel>

IsProductInCart(ProductViewModel, string)

Indicates wether the current product is placed in the context cart
public static bool IsProductInCart(this ProductViewModel product, string orderContextId = null)

Parameters

product ProductViewModel
The product we want to check
orderContextId string
The order context used to find the cart

Returns

bool
To top