November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
The image is associated with the product by its content guid, which is permanent. What you can do is probably this (pseudo untested code)
var contentLink = product.CommerceMediaCollection.First().AssetLink;
var media = contentRepository.Get<MediaData>(contentLink);
media.Name = "Can I actually do this";
contentRepository.Save(media, SaveAction.Publish, AccessLevel.None);
This is pretty close. You'll also want to update the RouteSegment value to show the updated name in the image url, and before you do anything create a writeable clone as the object returned by the repository will be read only. So something like;
var contentLink = product.CommerceMediaCollection.First().AssetLink;
var media = contentRepository.Get<MediaData>(contentLink);
var mediaClone = (ImageData)media.CreateWritableClone()
mediaClone.Name = "Can I actually do this";
mediaClone.RouteSegment = "Can I also do this"
contentRepository.Save(mediaClone, SaveAction.Publish, AccessLevel.None);
Hi,
I am looking into the possibility of renaming some images that have been assigned to a product in episerver commerce.
As I see it the only way that I can achieve would I would like to do is.
Seems alot of work to rename a filename.
Has anyone tried anything similar?
Thanks
Paul