0

We're creating some custom fields by adding new definition fields to category and product definition items in uCommerce.

When we retrieve an instance of the ctegory or prouduct from the uCommerce.Entitiesv2 we're having trouble getting the culture specific value for these fields when multilingual is selected?

There is a collection on the Product object called ProductDefinitionField but not sure whether .Value returns the culture specific version of whether we need to call another method (extention method maybe)

Has anyone got a code snipper for this?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
Tom Miller
  • 431
  • 1
  • 5
  • 16

1 Answers1

1

When accessing or retrieving Multilingual properties on a uCommerce you can use the GetProperty method on a product.

It has two overloads, one taking name (string) and another one taking name (string) and culturecode (string).

If you want to retrieve the full collection of multilinqual properties you can use GetProperties which also have two overloads. One without parameters and the other with a string culturecode.

Depending on the version of uCommerce you're using some of them might be missing/not a part of the API.

Best regards Martin

Martin
  • 123
  • 6
  • Thanks for your response @Martin. This works for categories when retrieving fields set as multilingual: category.GetProperty("some property").GetValue(); But when I try and do the same for a Product I get null returned. It does work however if I explicitly pass through the culture code: product.GetProperty("some property").GetValue() returns null product.GetProperty("some property", "en").GetValue() returns the translated value. Surely I shouldn't have to pass through the culture code as I would have thought this would be been inferred from the current Thread – Tom Miller Nov 29 '15 at 10:26
  • That sounds weird that the behavior is not the same for product/category GetProperties() method. I'm quite sure that if you want a multilingual property on a category you have to specify the culturecode as well (like on the product). I don't have access to an installation right now so I can test it. Can you just verify that the property on the category is indeed a multilingual field? (Notice if a non-multilingual field is changed into a multilingual field then data is not removed from the non version so it might be a false posivtive you see). – Martin Nov 29 '15 at 14:55