Developer forum

Forum » Development » Product favorites

Product favorites


Reply
In DynamicWeb we can add products to a favorit list. Is there a way for checking if a product is already submitted to the favorites list? We want to disable the "add to favorites" button when it is allready in this list. In this case we want to show a "remove from favorites" buttton.

Replies

 
Reply
You can do this in a couple of ways.

Frontend: Place all favorites in layers with the ID attribute set to something containing the product id, e.g. ID="Favorite_PROD01". Then, for each product in the cart:

if (document.getElementById("Favorite_"+ [Product ID here])){
    document.getElementById("Favorite_"+ [Product ID here]).style.display = "none";
}

Backend: Using a ProductListProvider you can filter the away the products server side, however, it may be difficult knowing which list to manipulate.

BR.
Lars

 

You must be logged in to post in the forum