Class FavoriteProductService
- Assembly
- Dynamicweb.Ecommerce.dll
public class FavoriteProductService : ICacheStorage<int, List<FavoriteProduct>>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
Favorite
Product Service
- 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
userId
intThe id of user
productId
stringThe product identifier
productVariantId
stringThe product variant identifier
favoriteListId
intThe 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
userId
intThe id of user
productId
stringThe product identifier
productVariantId
stringThe product variant identifier
referenceUrl
stringThe reference url
note
stringThe customer note
favoriteListId
intThe identifier of a favorite list
quantity
int
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
ClearCache(IEnumerable<int>)
Resets the specified keys to the default value for objects stored in the object cache
Parameters
keys
IEnumerable<int>Keys to reset
ClearCache(int)
Resets the specified key to the default value for objects stored in the object cache
Parameters
key
intKey to reset
Delete(FavoriteProduct)
Deletes the favorite product.
Parameters
favoriteProduct
FavoriteProduct The favorite product.
GetFavoriteProducts(int)
Gets products by favorites list id.
Parameters
favoriteListId
intThe id of favorites list.
Returns
- IEnumerable<Favorite
Product > The products in favorites list
MoveFavoriteProducts(IEnumerable<ProductVariantMoveSetting>)
Parameters
moveSettings
IEnumerable<ProductVariant >Move Setting
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
userId
intThe id of user
productId
stringThe product identifier
productVariantId
stringThe product variant identifier
favoriteListId
intThe 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.
Parameters
favoriteProduct
FavoriteProduct The favorite product.