Class ProductRelatedService
- Namespace
- Dynamicweb.Ecommerce.Products
- Assembly
- Dynamicweb.Ecommerce.dll
public class ProductRelatedService : ICacheStorage<string, IEnumerable<ProductRelated>>, ICacheStorage<string>, ICacheStorage
- Inheritance
-
ProductRelatedService
- Implements
- Inherited Members
Methods
ClearCache()
Clears the cache.
public void ClearCache()
ClearCache(IEnumerable<string>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<string> keys)
Parameters
keys
IEnumerable<string>Keys to reset
ClearCache(string)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(string key)
Parameters
key
stringKey to reset
Delete(IEnumerable<Product>)
Deletes all relations.
public void Delete(IEnumerable<Product> products)
Parameters
products
IEnumerable<Product>The products.
Delete(string, string, string, string)
Deletes the instance
public void Delete(string productId, string relatedGroupId, string relatedProductId, string relatedVariantId)
Parameters
productId
stringThe product id.
relatedGroupId
stringThe related group id.
relatedProductId
stringThe related product id.
relatedVariantId
stringThe related product variant id.
FindRelationsToProduct(string)
public IEnumerable<ProductRelated> FindRelationsToProduct(string relatedProductId)
Parameters
relatedProductId
string
Returns
FindRelationsToProduct(string, string)
public IEnumerable<ProductRelated> FindRelationsToProduct(string relatedProductId, string relatedProductVariantId)
Parameters
Returns
GetProductRelated(string, string, string, string)
Initializes a new instance of the ProductRelated class.
public ProductRelated GetProductRelated(string productId, string relatedGroupId, string relatedProductId, string relatedVariantId)
Parameters
productId
stringThe product id.
relatedGroupId
stringThe related group id.
relatedProductId
stringThe related product id.
relatedVariantId
stringThe related product variant id.
Returns
GetRelatedProductKeys(IEnumerable<string>)
Gets the related product keys by string representations of RelatedProductKey.
public IEnumerable<RelatedProductKey> GetRelatedProductKeys(IEnumerable<string> keys)
Parameters
keys
IEnumerable<string>Collection of keys, which represented by strings. See ToString().
Returns
GetRelations()
Gets all relations
public IEnumerable<ProductRelated> GetRelations()
Returns
GetRelations(string)
Gets the related products.
public IEnumerable<ProductRelated> GetRelations(string productId)
Parameters
productId
stringThe product id.
Returns
GetRelations(string, string)
Gets the related products.
public IEnumerable<ProductRelated> GetRelations(string productId, string relatedGroupId)
Parameters
Returns
GetRelations(string, string, bool)
Gets the related products.
public IEnumerable<ProductRelated> GetRelations(string productId, string languageId, bool activeOnly)
Parameters
productId
stringThe product id.
languageId
stringThe product language id.
activeOnly
boolSet to
true
to get only active products.
Returns
GetRelations(string, string, string, bool, string, string)
Gets the related products.
public IEnumerable<ProductRelated> GetRelations(string productId, string variantId, string languageId, bool activeOnly, string shopId = null, string countryCode = null)
Parameters
productId
stringThe product id.
variantId
stringlanguageId
stringThe product language id.
activeOnly
boolSet to
true
to get only active products.shopId
stringcountryCode
string
Returns
GetStructuredRelations(string, bool)
Gets a collection of product-group relations represented by a dictionary of key-relation pair.
public Dictionary<RelatedProductKey, ProductRelated> GetStructuredRelations(string productId, bool excludeVariants)
Parameters
productId
stringThe product id.
excludeVariants
boolIndicates whether product variant relations should be excluded.
Returns
GetStructuredRelations(string, bool, string)
Gets a collection of product-group relations represented by a dictionary of key-relation pair.
public Dictionary<RelatedProductKey, ProductRelated> GetStructuredRelations(string productId, bool excludeVariants, string relatedGroupId)
Parameters
productId
stringThe product id.
excludeVariants
boolIndicates whether product variant relations should be excluded.
relatedGroupId
stringThe related group id. This is used to filter the relations and return only relations that belong to this group.
Returns
Save(ProductRelated)
Saves the properties into DB.
public void Save(ProductRelated productRelated)
Parameters
productRelated
ProductRelatedThe product related.
SetCache(ProductRelated)
public void SetCache(ProductRelated relatedProduct)
Parameters
relatedProduct
ProductRelated
SetCache(string, IEnumerable<ProductRelated>)
public void SetCache(string key, IEnumerable<ProductRelated> relatedProducts)
Parameters
key
stringrelatedProducts
IEnumerable<ProductRelated>