PropertyList usage on Product Content

Vote:
 

I am looking to use PropertyList on a Product model but cannot get it to work. Have seen the same issues mentioned here, here and here

Can see a previous bug fix which suggests its supported but cannot find anything in documentation.

Tried the backing type of PropertyDictionaryMultiple and PropertyLongString.

   [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor))]
        [BackingType(typeof(PropertyDictionaryMultiple))]
        public virtual IList Faqs { get; set; }

Getting a cast error when saving the page - Unable to cast object of type 'EPiServer.Commerce.SpecializedProperties.ItemCollection`1[System.String]' to type 'System.Collections.Generic.IList`1[xxx.Website.ContentModels.Models.FaqItem]'.

Running  EPiServer.Commerce 10.6.0

The same property works perfectly on CMS pagetype. Anybody got any ideas?

#180595
Jul 14, 2017 17:28
Vote:
 

I have the same issue in Commerce 11.8.1. Is anything wrong with the setup Gareth provided?

The worst thing is that there is no documentation how to set up this - no info about CMS nor Commerce:

https://world.episerver.com/Search/?searchQuery=propertylist

#189413
Edited, Mar 19, 2018 9:23
Vote:
 

This should be the reason it's not working for you

        [BackingType(typeof(PropertyDictionaryMultiple))]

Basically the system does not know how to convert back and forth between your custom type (FaqItem) and DictionaryItem. In this case it's best that you create your own PropertyList type, inherit from PropertyList<T> and handle the serialization/deserialization yourself. 

#189419
Mar 19, 2018 10:47
Vote:
 

Good point. I'll see what I can do, 

#189420
Mar 19, 2018 11:01
Vote:
 

Thanks, Quan!

In my case, I missed PropertyDefinitionTypePlugIn attribute on my property definition type.

But now I am getting another exception:

EPiServer.Find.Cms.ContentEventIndexer: An exception occurred while indexing (IContent). "[{"filterUrl":"Test","title":"Test","description":"<p>Test</p>"}]" is not a valid value for "Filter header metadata"..
EPiServer.Core.InvalidPropertyValueException: "[{"filterUrl":"Test","title":"Test","description":"<p>Test</p>"}]" is not a valid value for "Filter header metadata". ---> System.ArgumentException: Property value must implement IList<T> or IEnumerable<T>.

My property implements IList, so it looks weird. My property definition looks like this:

[Display(Name = "Filter header metadata", Order = 120)]
[BackingType(typeof(FilterCategoryHeaderPropertyList))]
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<FilterCategoryHeader>))]
public virtual IList<FilterCategoryHeader> FilterCategoryHeaderList { get; set; }

The only thing is that this property is on the block and not on the content directly.

What could be wrong with this?

#189426
Mar 19, 2018 11:53
Vote:
 

After trying different solutions I tried to add the property list directly to the commerce content and it worked.

So now blocks with such properties are not supported in Commerce.

#189428
Mar 19, 2018 13:00
Vote:
 

Yes, you were faster than me. The handling for PropertyList is only for MetaField. Commerce treats blocks as XHTML properties and it does not really look inside of blocks.

#189429
Mar 19, 2018 13:09
Vote:
 

Could there be any fix or at least some meaningful exception?

#189432
Mar 19, 2018 13:21
Vote:
 

I don't know - there might be some known limitation which I'm unaware of. As always, a seemingly small issue can require a complicated fix - or even a rewrite. I'll file a bug to see if we can do something, but I can't promise anything (just yet) 

#189433
Mar 19, 2018 13:26
Vote:
 

Ok. But it should be documented then with a note that property lists cannot be used in a block which is used in a commerce content.

#189434
Mar 19, 2018 14:05
Vote:
 

Hi!

Just an update, the bug has been fixed and will be out in next version, probably 12.7.0 (we're preparing for the release 12.6.0 actually).

/B

#195893
Aug 10, 2018 12:16
Vote:
 

Hi, Bien!

I am looking at the release info: https://world.episerver.com/documentation/Release-Notes/?versionFilter=12.6.0&packageFilter=EPiServer.Commerce&typeFilter=All

and 12.6.0 does not contain the fix.

Is it released and property lists can be used in the blocks within commerce content now?

#196307
Aug 24, 2018 12:57
Vote:
 

It's in Commerce 12.7 which will be published to the feed soon (enough) :) 

#196308
Aug 24, 2018 12:59
Vote:
 

It's in Commerce 12.7 which will be published to the feed soon (enough) :) 

#196309
Aug 24, 2018 12:59
Vote:
 

Thanks for update Quan!

#196310
Aug 24, 2018 13:01