Declaring Product Picker Property programmatically

Vote:
 

I would like to use the built in property Product Picker Property from Commerce to map products to pages. But i'm getting 500 on my site when i'm trying to declare the property. My Code looks like this:

[Display(
            Name = "Test",
            Description = "Test",
            GroupName = SystemTabNames.Settings,
            Order = 760)]
        public virtual EPiServer.Business.Commerce.UI.Edit.ProductPicker.SpecializedProperties.ProductPickerProperty Test { get; set; }  

I created a ProductPickerProperty from admin mode in episerver, and looked the property up in the database, and the namespace above was declared, so I assume i'm missing some other part.


Log file is throwing:

 

ERROR EPiServer.Framework.Initialization.InitializationEngine: Type lookup failed
System.Reflection.CustomAttributeFormatException: 'GUID' property specified was not found. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at EPiServer.DataAnnotations.ContentTypeAttribute.set_GUID(String value)

I can of course do this task with a different approach, but it feels like the right way to use whats built in.

Anyone with input on this one?

#75905
Oct 10, 2013 15:48
Vote:
 

Got it.

[BackingType(typeof(ProductPickerProperty))]
        [Display(
            Name = "Short intro",
            Description = "",
            GroupName = SystemTabNames.Content,
            Order = 150)]
        public virtual string ShortIntro { get; set; }

#75906
Oct 10, 2013 16:28
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.