Add field to CommerceMedia

Vote:
 

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

#142511
Dec 11, 2015 17:31
Vote:
 

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.

#142526
Dec 12, 2015 5:05
Vote:
 

Hi, Ton.

Thank you for reply.

Could you provide example, please?

Best Regards.

#142534
Dec 14, 2015 8:33
Vote:
 

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.

#142536
Dec 14, 2015 10:05
Vote:
 

I want to add string Field.

For example:

public string Caption { get; set; }

#142537
Dec 14, 2015 10:08
Vote:
 

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

#142706
Edited, Dec 18, 2015 16:18
Vote:
 

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.

#142722
Edited, Dec 21, 2015 11:01
Vote:
 

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

#142754
Dec 21, 2015 17:36
Vote:
 

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.

#143034
Jan 11, 2016 9:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.