Try our conversational search powered by Generative AI!

Question about retrieving Commerce ImageFile meta field path

Vote:
 

Hi all,

Episerver Find version 12.6.0 and Episerver Commerce version 11.2.4

We can access most meta fields for search results by defining them in a custom class for our CatalogContentType:

    [CatalogContentType(MetaClassName = "TestProductEntry", DisplayName = "Test Product Entry", Description = "")]
    public class TestProductEntry : ProductContent
    {

        [IncludeValuesInSearchResults]
        [DecimalSettings(18, 2)]
        public virtual decimal TestPercentage { get; set; }

   }

But when it comes to images (field type ImageFile) we have come across a few issues:

  • We have not found a way in documentation or via trial and error for hard typing the image path as a property like the example above
  • We are able to load the MetaFile for the image using MetaObject.Load of the product in question. However AssetUrlResolver requires an IAssetContainer type so we can't use it to retrieve the image path.

How can we retrieve Commerce ImageFile paths?

Thanks!

#183049
Oct 04, 2017 0:48
Vote:
 

Generally we recommend to upload your images as assets (aka CMS content) and attach them to them the products via CommerceMediaCollection instead. That would provide a better performance and more flexible way to handle the images.

#183054
Oct 04, 2017 7:33
* 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.