Hi David,
Try the EditorDescriptor & Attributes for the CategoryList property.
https://getadigital.com/no/blogg/improved-categorylist-editor-descriptor-for-episerver/
You would need a backing type so Commerce knows how to map your property to one of its internal types. But is there a reason you can't use IList<T> instead? (I'm not familiar with CategoryList)
[BackingType(typeof(PropertyIntegerList))]
public virtual IList<int> IntegerList { get; set; }
instead?
@Sanjay this still requires the property be a CategoryList, which throws the same NotSupportedException.
@Quan an int list does not provide the editor with the ability to select from a list of the Admin defined Category values, therefore it is not sufficient.
The category list should look like this on the Commerce Product: https://imgur.com/a/KQfWKNU
Surely this is not limited to only the CMS?
I see. You can technically try out with this attribute
[BackingType(typeof(PropertyString))]
Untested obviously so I'm not sure if it works. CategoryList overrides ToString to create a joined list with , separator so it might ...
In Episerver Commerce.Core (13.19.0) I am able to create the below the property.
public virtual CategoryList SearchContext { get; set; }
Thank you for showing that it's possible Sanjay!
I've upgraded to the latest version of Commerce and am getting the same exception. Are there perhaps other settings that dictate what properties can and cannot be added?
@Sanjay can you confirm that is a product in your screenshot? It looks like the tabs belong to a page, not a product type inheriting from Episerver Commerce's base ProductContent type, which has the "Belongs To", "Variants", "Assets", etc tabs, which is where the issue occurs.
@Quan the PropertyString backing type throws a TypeMismatchException when it is applied to a property that is not of type string.
Yes, that is confirmed the tabs belong to a page, not a product.
Can try to inherit ICategorizable interface on your page?
e.g.:
public interface IPage : IContent, ICategorizable {}
public class MyPage : PageData, IPage{}
The ProductContent base class implements ICategorizable, but the Categories field hooks in to a different Commerce Category system than the CMS.
It also doesn't seem to allow you to add multiple fields of type Category to a single product. If you do, the UI doesn't allow you to add categories to the new Categories property: https://imgur.com/P0EkdkP
We were hoping to add multiple category fields that could be used as distinct Facets in an Epi Find search app. I suppose we could try adding a multi select checkbox with a selection factory that pulls the list of categories as a workaround. Would love to see this work out of the box.
The ProductContent base class implements ICategorizable, but the Categories field hooks in to a different Commerce Category system than the CMS.
It also doesn't seem to allow you to add multiple fields of type Category to a single product. If you do, the UI doesn't allow you to add categories to the new Categories property: https://imgur.com/P0EkdkP
We were hoping to add multiple category fields that could be used as distinct Facets in an Epi Find search app. I suppose we could try adding a multi select checkbox with a selection factory that pulls the list of categories as a workaround. Would love to see this work out of the box.
Hi, I'm trying to add a property of type CategoryList to the model of a product on an epi commerce site, but receive the following exception stating that CategoryList cannot be mapped to a MetaDataType.
Does this mean Episerver CMS Categories are simply not compatible with Commerce products? How would I go about tagging Epi Commerce Products with Episerver CMS Categories?
I've added the property like so:
[Display(
Name = "Search Context",
Description = "Select the contexts you want your content to connect to",
GroupName = SystemTabNames.Content,
Order = 1)]
public virtual CategoryList SearchContext { get; set; }
Using Episerver 11.13.2.0
Episerver.Commerce 13.12.0: