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
keysIEnumerable<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
keystringKey to reset
Delete(IEnumerable<Product>)
Deletes all relations.
public virtual void Delete(IEnumerable<Product> products)
Parameters
productsIEnumerable<Product>The products.
Delete(string, string?, string?, string?)
Deletes the instance
public virtual void Delete(string productId, string? relatedGroupId, string? relatedProductId, string? relatedVariantId)
Parameters
productIdstringThe product id.
relatedGroupIdstringThe related group id.
relatedProductIdstringThe related product id.
relatedVariantIdstringThe related product variant id.
FindRelationsToProduct(string)
public virtual IEnumerable<ProductRelated> FindRelationsToProduct(string relatedProductId)
Parameters
relatedProductIdstring
Returns
FindRelationsToProduct(string, string)
public virtual IEnumerable<ProductRelated> FindRelationsToProduct(string relatedProductId, string relatedProductVariantId)
Parameters
Returns
GetProductRelated(string, string, string, string)
Initializes a new instance of the ProductRelated class.
public virtual ProductRelated? GetProductRelated(string productId, string relatedGroupId, string relatedProductId, string relatedVariantId)
Parameters
productIdstringThe product id.
relatedGroupIdstringThe related group id.
relatedProductIdstringThe related product id.
relatedVariantIdstringThe related product variant id.
Returns
GetRelatedProductKeys(IEnumerable<string>)
Gets the related product keys by string representations of RelatedProductKey.
public virtual IEnumerable<RelatedProductKey> GetRelatedProductKeys(IEnumerable<string> keys)
Parameters
keysIEnumerable<string>Collection of keys, which represented by strings. See ToString().
Returns
GetRelations()
Gets all relations
public virtual IEnumerable<ProductRelated> GetRelations()
Returns
GetRelations(string)
Gets the related products.
public virtual IEnumerable<ProductRelated> GetRelations(string productId)
Parameters
productIdstringThe product id.
Returns
GetRelations(string, string?)
Gets the related products.
public virtual IEnumerable<ProductRelated> GetRelations(string productId, string? relatedGroupId)
Parameters
Returns
GetRelations(string, string, bool)
Gets the related products.
public virtual IEnumerable<ProductRelated> GetRelations(string productId, string languageId, bool activeOnly)
Parameters
productIdstringThe product id.
languageIdstringThe product language id.
activeOnlyboolSet to
trueto get only active products.
Returns
GetRelations(string, string, string, bool, string?, string?)
Gets the related products.
public virtual IEnumerable<ProductRelated> GetRelations(string productId, string variantId, string languageId, bool activeOnly, string? shopId = null, string? countryCode = null)
Parameters
productIdstringThe product id.
variantIdstringlanguageIdstringThe product language id.
activeOnlyboolSet to
trueto get only active products.shopIdstringcountryCodestring
Returns
GetRelations(string, string, string, string?, bool, string?, string?)
Gets the related products for the relation group specified by its related group id.
public virtual IEnumerable<ProductRelated> GetRelations(string productId, string variantId, string languageId, string? relatedGroupId, bool activeOnly, string? shopId = null, string? countryCode = null)
Parameters
productIdstringThe product id.
variantIdstringlanguageIdstringThe product language id.
relatedGroupIdstringThe related group id.
activeOnlyboolSet to
trueto get only active products.shopIdstringcountryCodestring
Returns
GetStructuredRelations(string, bool)
Gets a collection of product-group relations represented by a dictionary of key-relation pair.
public virtual Dictionary<RelatedProductKey, ProductRelated> GetStructuredRelations(string productId, bool excludeVariants)
Parameters
productIdstringThe product id.
excludeVariantsboolIndicates 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 virtual Dictionary<RelatedProductKey, ProductRelated> GetStructuredRelations(string productId, bool excludeVariants, string? relatedGroupId)
Parameters
productIdstringThe product id.
excludeVariantsboolIndicates whether product variant relations should be excluded.
relatedGroupIdstringThe 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 virtual void Save(ProductRelated productRelated)
Parameters
productRelatedProductRelatedThe product related.
SetCache(ProductRelated)
public virtual void SetCache(ProductRelated relatedProduct)
Parameters
relatedProductProductRelated
SetCache(string, IEnumerable<ProductRelated>)
public virtual void SetCache(string key, IEnumerable<ProductRelated> relatedProducts)
Parameters
keystringrelatedProductsIEnumerable<ProductRelated>