Posted on 17/03/2023 12:06:17
Hi Frederik
I am not sure you can use that anymore - it is depending on old analytics and old product catalog module which are both being faced out. So if you are using the new viewmodel version of the product catalog it cannot work.
It is super simple to do custom any ways:
First in your product detail template add a string array to session:
if (Cache.Current["RelatedProductListProviderTypes"] is null)
{
Context.Current.Session.Add("youHaveSeenTheseProductsList", new string[] { "prod1" });
}
else
{
var productIds = ((string[])Dynamicweb.Context.Current.Session["youHaveSeenTheseProductsList"]).ToList();
productIds.Add("prod2");
Context.Current.Session["youHaveSeenTheseProductsList"] = productIds.ToArray();
}
And then fetch them something like this:
if (Cache.Current["RelatedProductListProviderTypes"] is null)
{
if (Context.Current.Session["youHaveSeenTheseProductsList"] != null)
{
var productIds = (string[])Dynamicweb.Context.Current.Session["youHaveSeenTheseProductsList"];
var youHaveSeenTheseProductsList = Dynamicweb.Ecommerce.Services.Products.GetByProductIDs(productIds, false, Common.Context.LanguageID, true, true);
}
}
BR Nicolai