Type 'EPiServer.Core.MediaData' could not be mapped to a PropertyDefinitionType

Member since: 2007

Hi! We are upgrading commerce from v5.2 628 to 8.2.

In the new catalog UI, we don't see the Images, they are metafields of type "Image file" on Product (is is working in Commerce UI )

In code first aproach i get on mya CatalogProduct:

Type 'EPiServer.Core.MediaData' could not be mapped to a PropertyDefinitionType (or my custom ImageFile type)

[CatalogContentType(MetaClassName = "DefaultProduct")] public class CatalogProduct : ProductContent ... and so on

public virtual MediaData ProductImage1 { get; set; }

Is there a backing type?

Are we suppose to change way to attach images to a product? 

#114794 Dec 22, 2014 15:51
  • Hi Luc,

    Convert your mediadata properties to use content references instead, then you add a UIHint attribute to it. Are you using the new media system or the old Commerce legacy asset system?

    Cheers,

    Tobias

    #114799 Dec 22, 2014 17:43
  • Member since: 2011

    Hi,

    We don't support the image file metafield in Catalog UI. You'll need to use Commerce Manager to manage it.

    And if there is nothing prevents you from using new Asset system, we recommend to switch to it (use AssetMigrationTool to migrate files). And to use media in new Catalog UI, you can use ContentReference type as Toni suggested.

    Regards.

    /Q

    #114811 Dec 23, 2014 2:03
  • Member since: 2007

    Thanks! I get it.

    I can either use URL and ContentReference. ContentReference is to prefer what i understand.

    I will use the new media system of course. 

    We did not have any images/docs in old commerce "asset management", so when running AssetMigrationTool it didn't help converting the blob images saved on the product meta field.

    I should probably make a script that; foreach product; save images in mediafiles/productfolder; connect it to assets on product; delete the old blobs; delete the old metafields;

    I could use your example here http://world.episerver.com/Forum/Developer-forum/EPiServer-Commerce/Thread-Container/2014/1/Bulk-import-product-images---Commerce-75/

    Is this a good idea?

    #114815 Dec 23, 2014 9:30
  • Member since: 2011

    It should work. You can also you the catalog content CommerceMediaCollection property, but you can stick with the DTO approach for similiarity.

    Basic steps are:

    - Use the code the convert the image file metafield to a normal media content

    - Update the catalog content to include the reference to new media content. I would suggest to use CommerceMediaCollection instead of adding another ContentReference property to your catalog content.

    Regards.

    /Q

    #114816 Dec 23, 2014 9:58
  • Member since: 2007

    Thanks, CommerceMediaCollection is the way to go.

    #114819 Dec 23, 2014 10:34