November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Are you removing those via code? If that's the case, them the following link may be helpful
Hi! I am using the following code to delete so that's not the issue:
var clone = content.CreateWritableClone<EntryContentBase>();
var commerceMedia = clone.CommerceMediaCollection.FirstOrDefault(x => x.AssetLink.CompareToIgnoreWorkID(mediaData.ContentLink));
if (commerceMedia != null)
{
clone.CommerceMediaCollection.Remove(commerceMedia);
_contentRepository.Save(clone, SaveAction.ForceCurrentVersion, AccessLevel.NoAccess);
}
Looks like a bug, when you make changes to the assets, the cache that is used by GetReferencesToContent is not properly cleared. I will file a bug to Commerce team. Thanks for bringing this into our attention.
Thanks Quan!
This is the workaround I'm using until the bug is fixed. 😂
$"SELECT [CatalogEntryId] FROM [CatalogItemAsset] WHERE [CatalogEntryId] > 0 AND [AssetKey] LIKE '%{resourceId}'"
We are trying to use GetReferencesToContent method of content repository to determine if a media file is referenced by any products/variants. It seems to return content reference to all products that have a reference to the media file, which is fine, but if I remove the reference on all those products, save them with content repository and then call the GetReferencesToContent again, it returns the same references as the first time. The references are in fact removed and they don't show up in the UI.
Is there any caching delay for this method?