Developer forum

Forum » Development » Customer Center Add to favorites dublicated product check

Customer Center Add to favorites dublicated product check

Mikkel Høst
Reply
Hello.

I have to make a check, when a product is added to the favorites list in Customer Center. If the product is allready present on the list i need to set a template tag so i can alert the user that the product is allready there.

I have decompiled the code and AFAIK i can't subscribe to the event. I see this ObServer. And it pretty much does escatly what i want except the check :8

Any ideas how to do this?

namespace Dynamicweb.eCommerce.CustomerCenter
{
	[Subscribe("DWN_STANDART_PAGE_LOADED")]
	public class AddToFavoritesObserver : NotificationSubscriber
	{
		public override void OnNotify(string notification, object[] args)
		{
			string text = Base.Request("CCAddToFavorites");
			if (Operators.CompareString(text, "", false) != 0 && new Extranet().UserID > 0)
			{
				string text2 = Base.Request("CCAddToFavoritesVariantID");
				string text3 = Base.Request("CCAddToFavoritesLanguageID");
				text2 = Strings.Trim(text2);
				text3 = Strings.Trim(text3);
				text = Strings.Trim(text);
				FavoritesList.Commands.AddToFavorites(text, text2, text3);
				HttpContext.Current.Response.Redirect(Base.StrippedQueryString("CCAddToFavorites*, CCRemoveFromFavorites*"));
			}
		}
	}
}
 

Replies

 
Mikkel Høst
Reply
 Typical, 10 minutes after i post i get an idea :)

Create a new NotificationSubscriber that does excatly the same, just with the dub check and then alter the queryString from the AddToFav submits to something unique :)


 

You must be logged in to post in the forum