Hi guys,
Wanted to ask if there is a easy way of accessing customers favorite products instead of accessing tables directly? :)
Hi guys,
Wanted to ask if there is a easy way of accessing customers favorite products instead of accessing tables directly? :)
You can add a paragraph with the Customer Center module and create a template to display the loop of favorite products.
You can get the favorite products programmatically by doing something like this...
int userId = Dynamicweb.Modules.UserManagement.User.GetCurrentUserID(); Collection<FavoriteList> lists = new Dynamicweb.eCommerce.CustomerCenter.FavoritesLists(userId); foreach (FavoriteList list in lists) { foreach (Product product in list) { // Do something? } }
Hi Morten
I am new in Dynamicweb API... I have a problem creating a FavoriteList using the API. Can you show me how to creat a new list and add a product and the save is.
My test code look like this... but i can't save it?
Dynamicweb.Modules.UserManagement.User user;
user = Dynamicweb.Modules.UserManagement.User.GetUserByUserName("480010");
int userId = user.ID;
Collection<Dynamicweb.eCommerce.CustomerCenter.FavoritesList> lists = new Dynamicweb.eCommerce.CustomerCenter.FavoritesLists(userId);
Dynamicweb.eCommerce.CustomerCenter.FavoritesList item = new Dynamicweb.eCommerce.CustomerCenter.FavoritesList(1, "Favorit liste");
Dynamicweb.eCommerce.Products.Product p = Dynamicweb.eCommerce.Products.Product.GetProductByNumber("1600040");
item.Add(p);
lists.Add(item);
You must be logged in to post in the forum