Class FavoriteProductService
- Assembly
- Dynamicweb.Ecommerce.dll
public class FavoriteProductService : ICacheStorage<int, List<FavoriteProduct>>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
FavoriteProductService
- Implements
- Inherited Members
Methods
AddProductToFavoriteList(int, string, string?, int)
Add the specified product into a favorite list.
public void AddProductToFavoriteList(int userId, string productId, string? productVariantId, int favoriteListId = 0)
Parameters
userIdintThe id of user
productIdstringThe product identifier
productVariantIdstringThe product variant identifier
favoriteListIdintThe identifier of a favorite list
Remarks
If a FavoriteListId Is provided, the product should be added To that FavoriteList otherwise, the product should just be added To the Default favorite list For the current user (If it doesn't exist, it should be created).
AddProductToFavoriteList(int, string, string?, string?, string?, int, int)
Add the specified product into a favorite list.
public void AddProductToFavoriteList(int userId, string productId, string? productVariantId, string? referenceUrl, string? note, int favoriteListId = 0, int quantity = 1)
Parameters
userIdintThe id of user
productIdstringThe product identifier
productVariantIdstringThe product variant identifier
referenceUrlstringThe reference url
notestringThe customer note
favoriteListIdintThe identifier of a favorite list
quantityint
Remarks
If a FavoriteListId Is provided, the product should be added To that FavoriteList otherwise, the product should just be added To the Default favorite list For the current user (If it doesn't exist, it should be created).
ClearCache()
Resets all keys to the default value for objects stored in the object cache
public void ClearCache()
ClearCache(IEnumerable<int>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<int> keys)
Parameters
keysIEnumerable<int>Keys to reset
ClearCache(int)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(int key)
Parameters
keyintKey to reset
Delete(FavoriteProduct)
Deletes the favorite product.
public void Delete(FavoriteProduct favoriteProduct)
Parameters
favoriteProductFavoriteProductThe favorite product.
GetFavoriteProducts(int)
Gets products by favorites list id.
public IEnumerable<FavoriteProduct> GetFavoriteProducts(int favoriteListId)
Parameters
favoriteListIdintThe id of favorites list.
Returns
- IEnumerable<FavoriteProduct>
The products in favorites list
MoveFavoriteProducts(IEnumerable<ProductVariantMoveSetting>)
public virtual void MoveFavoriteProducts(IEnumerable<ProductVariantMoveSetting> moveSettings)
Parameters
moveSettingsIEnumerable<ProductVariantMoveSetting>
RemoveProductFromFavoriteList(int, string, string?, int)
Remove the specified product from a favorite list.
public void RemoveProductFromFavoriteList(int userId, string productId, string? productVariantId, int favoriteListId)
Parameters
userIdintThe id of user
productIdstringThe product identifier
productVariantIdstringThe product variant identifier
favoriteListIdintThe identifier of a favorite list
Remarks
In this action, there's a number of different actions that should be performed depending on the parameters.
- If both the ProductId And ProductVariantId Is provided, the specific variant should be removed from the favorite list matching the provided FavoriteListId.
- If only the ProductId Is provided, all products/variants matching that ProductId should be removed from the favorite list matching the provided FavoriteListId.
Save(FavoriteProduct)
Saves the favorite product.
public void Save(FavoriteProduct favoriteProduct)
Parameters
favoriteProductFavoriteProductThe favorite product.