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
ProductViewModelunitId
stringstocklocationId
long
Returns
GetGroupLink(GroupInfoViewModel, int, 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
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
ProductViewModelgroupSystemNames
IEnumerable<string>hideZeroValues
bool
Returns
GetProductLink(ProductViewModel, int, bool)
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
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
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
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
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