PropertyList in Commerce error


I am trying to use a propertylist within commerce, but I get a type converesion error.

The type System.Collections.Generic.IList`1[[System.String, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]] can not be mapped to a MetaDataType

Has anybody ever used a property list within a commerce ProductNode object?

Jul 14, 2016 22:27

You'll have to set the backing type for your property, something like this

public virtual IEnumerable<string> MultipleValue { get; set; }

Jul 15, 2016 7:15

How would I set up a custom editor then using that as the backing type?  I tried EditorDescriptor but it seems like it is no longer loading the all properties page.

Jul 15, 2016 21:52

I'm still having trouble with this property.  I have set it as you suggested, and I am not getting any visual representation of it on the screen.  It only shows the field name and then it is blank next to it.  I think it would be really good to have Epi develop the ability to have a collection of strings for commerce as I would imagine many people would want to utilize something like that.

Aug 23, 2016 22:09

It seems like support was added for this based on the release notes, but I am trying to save data to the field in question via the content repostiory function.  It saves other data, but anything that is of type ItemCollection<string> is not being saved to the database even though I know I am adding it to the object.

//product exists already, update the data
                        ProductNode prod = _contentRepo.Service.Get<ProductNode>(_referenceConverter.Service.GetContentLink("Item_" + product.ItemNumber));
                        prod = prod.CreateWritableClone<ProductNode>();

                        //loop through same product and apply all state codes at once
                        if (!prod.StateRestrictions.Contains(product.StateCode))
                            _contentRepo.Service.Save(prod, SaveAction.Save);


Edited, Sep 27, 2016 14:46

I was able to get this to start saving data.  The issue was that when using the ItemCollection<string> you have to set the value to a predefined value in the dictionary for that field.  I needed to go into commerce and manually add any values that I needed to assign programatically and then everything worked.  The next thing I need to do is programatically add those values as well so I don't have to manual do it since I have several lists to process.

Oct 03, 2016 20:50
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.