You need to extend the CommerceMedia class to include the new field, and also you need to extend and add the new field the CommerceMediaModel, which is the client model of CommerceMedia. Then register your new CommerceMediaModelConverter so it can convert the server model CommerceMedia to client model CommerceMediaModel, and vice versa.
Hi, Ton.
Thank you for reply.
Could you provide example, please?
Best Regards.
It turns out to be quite tricky for doing that. What field do you want to add? Maybe we can figure out the other solution.
I want to add string Field.
For example:
public string Caption { get; set; }
Hi,
If you are expecting a Caption for Image
[ContentType(GUID = "")] [MediaDescriptor(ExtensionString = "jpg,jpeg,jpe,ico,gif,bmp,png")] public class ImageFile : ImageData { public virtual string Caption { get; set; } }
this property will definatly be available in Edit Mode.
Regards
/K
Hi, Khan.
Thank you for reply.
But, If we will use this approach, we can't see caption on the popup, we can see only on the edit page of image.
Best Regards.
Hi,
In Theory, Caption is a property of Media, The popup that you attached, is not to show Media properties that is about associating the media with a group name. It can be done by some customization, but wondering will customization in scope?
Regards
/K
Hi.
I wanted to add an additional field to the CommerceMedia, because I need to have a caption of image for product, not for all products, which use this image.
For example:
Product1 has image
Product2 has image
Expected:
Product1: caption1 of image
Product2: caption2 of image
And user can edit this caption on the popup.
I think, it's impossible because we can't expand table of CommerceMedia in DB.
Best Regards.
Hi.
I need to add additional field for assets. Commerce -> Catalog -> Variation Edit page -> Assets pane
How can I do it? Maybe I can expand CommerceMedia class?
Version EPiServer.Commerce.Core.8.16.1
Best regards