Hi DynamicWeb,
It seems like we are missing a SetResetNeeded call when switching a product from inactive to active in this part of the code:
[Subscribe(Notifications.Ecommerce.Product.AfterSave)]
[Subscribe(Notifications.Ecommerce.Product.AfterDelete)]
public class ProductChangedObserver : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
if (SystemConfiguration.Instance.GetBoolean("/Globalsettings/System/Url/HighVolumeProductUrls/Enable"))
return;
var changeAffectUrlIndex = false;
if (args is Dynamicweb.Ecommerce.Notifications.Ecommerce.Product.AfterSaveArgs)
{
var saveArgs = args as Notifications.Ecommerce.Product.AfterSaveArgs;
var beforeSaveProduct = saveArgs.ProductBeforeChanges;
var afterSaveProduct = saveArgs.Product;
if (beforeSaveProduct != null)
{
foreach (var group in beforeSaveProduct.Groups)
{
if (GroupService.IsGroupInEcommerceShop(group) is true)
{
break;
}
return; //The product is not member of any ecommerce groups
}
changeAffectUrlIndex |= !beforeSaveProduct.Id.Equals(afterSaveProduct.Id, StringComparison.OrdinalIgnoreCase);
changeAffectUrlIndex |= !beforeSaveProduct.VariantId.Equals(afterSaveProduct.VariantId, StringComparison.OrdinalIgnoreCase);
changeAffectUrlIndex |= !beforeSaveProduct.LanguageId.Equals(afterSaveProduct.LanguageId, StringComparison.OrdinalIgnoreCase);
changeAffectUrlIndex |= !beforeSaveProduct.Name.Equals(afterSaveProduct.Name, StringComparison.OrdinalIgnoreCase);
changeAffectUrlIndex |= !beforeSaveProduct.Meta.Url.Equals(afterSaveProduct.Meta.Url, StringComparison.OrdinalIgnoreCase);
}
else
{
changeAffectUrlIndex = true;
}
}
if (changeAffectUrlIndex)
{
lazyProductUrlDataIndex = new Lazy<ConcurrentDictionary<string, Dictionary<string, UrlDataNode>>>(InitializeProductUrlDataIndex);
UrlHelper.SetResetNeeded();
}
}
}
The result is that the product is only available with "?ProductId=" in the url, and not as a search friendly url. Can you please try to look into that?
Best regards, Anders