Developer forum

Forum » Development » Bug in the API?

Bug in the API?

Martin Nielsen
Reply

Hi DW,

 

I'm trying to get the value of a category field via the API, and i've found a solution which i though would work, but it doesn't.

 

object type = theEvent.GetCategoryValue( "Events", "ProfileType" );

 

The above example returns null. but if i do this:

Dynamicweb.eCommerce.Products.Categories.Field f = null;
foreach ( Dynamicweb.eCommerce.Products.Categories.Category cat in theEvent.GetCategories() )
{
  if ( cat.Name.Equals( "Events" ) )
  {
    foreach ( Dynamicweb.eCommerce.Products.Categories.Field field in cat.Fields )
    {
      if ( field.ID.Equals( "ProfileType" ) )
      {
        f = field;
      }
    }
  }
}
type = theEvent.GetCategoryValue( "Events", f );

i get out my value.

 

Shouldn't Product.GetCategoryValue() return the value?

 

// Martin


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Martin,

 

Yes, you are correct. That is indeed a bug. It seems that the category values for the product are not verified when using then mentioned overload.

 

I have created a bug report for this issue. The number is #12956. Currently, I don't have a timeframe for a fix.

 

- Jeppe

Votes for this answer: 1
 
Martin Nielsen
Reply

NP. The workaround works :-)

 

You must be logged in to post in the forum