Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Stefan 13 posts 53 karma points
    Sep 23, 2013 @ 11:12
    Stefan
    0

    Key/Value as Product Property

    Hi, 

    is it possible to add some kind of key value pair as a product property. We need a color definition where we have to define a code '0010' and the name of the color 'red'. We want to see both in the administration and want to use both via the api. 

    Any recommendation? 

     

    Thanks and regards,

    Stefan

  • Lars Horne-Mortensen 40 posts 184 karma points
    Sep 23, 2013 @ 13:34
    Lars Horne-Mortensen
    0

    Hi Stefan,

    I think the Enum data type can do what you want.

    With the Enum data type, you define a value and a display name, for every enum entry. So you can define the enum value as "0010" and the display name as "red".

    Hope that helps,

    Lars

  • Stefan 13 posts 53 karma points
    Sep 23, 2013 @ 13:39
    Stefan
    0

    Hi Lars, 

     

    thanks for your reply. Sometimes it is to simple... 

    How can I access the display name for my culture via the API?


    Thanks,

    Stefan

  • Lars Horne-Mortensen 40 posts 184 karma points
    Sep 23, 2013 @ 13:58
    Lars Horne-Mortensen
    0

    Hi Stefan,

    You can get the enum property by calling the GetProperty() method on the product, something like this:

    product.GetProperty("propertyName", "cultureCode").GetValue()
    

    And get the display name like this:

    var property = product["propertyName"];
    var propertyEnum = property.ProductDefinitionField.DataType.DataTypeEnums.Single(x => x.Value == property.Value);
    var enumDisplayName = propertyEnum.GetDescription("cultureCode").DisplayName;
    

    /Lars

  • Stefan 13 posts 53 karma points
    Sep 23, 2013 @ 15:15
    Stefan
    0

    Hi Lars, 

    Great! Thats exactly what I was looking for.

    Thanks!

    Stefan

     

     

Please Sign in or register to post replies

Write your reply to:

Draft