Developer forum

Forum » Development » Category values in variants

Category values in variants

Marco Santos
Reply

Hello.

I have a OrderIsPassedToCheckoutHandler in which I am checking for category values for the products in the order lines, like so:

foreach (var orderLine in currentOrder.OrderLines) {
    var restrictedStatesForProduct = orderLine.Product.GetCategoryValue(STATES_CATEGORY, STATES_FOR_PRODUCT);

And then doing some processing (the values, when available, are a comma separated list). This was working, until I changed the product to have variants, and have the category be the same for the product and variants. After that it started coming as null. I also tried loading the main product if the value was null, so I could get to the values from there, but that also comes back as null.

Is there a way to get around this? Or am I missing something maybe?

Thanks,

Marco


Replies

 
Viktor
Reply

Hi Marco,

Thank you for your appealwe really appreciate it.

Today I've researched your issue, and found that method you've specified returns not null. I've tested it on decimal category field - my steps:
1) I've changed the category field value for product A(it already has 3 variants) and for product B(it has no variants)
2) Added products to cart
3) when cart is rendering, i've made output of category values applied to orderlines names, there was values for both: product A and product B
4) i've added variants to product B
5) cleared the cart and added both products and variant of product B
6) all of these orderlines correctly have showed category values.

Also i've updated product index after each changes with products(i.e. adding variants and changing their name, field values)

Could you please submit in details your steps when you reproducing the problem.

Best regards,
Viktor Letavin
DynamicWEB Software A/S, Russian team One
 
Nuno Aguiar
Reply

Hi Viktor,

 

We are in fact having problems with some field values passing over to the variants. It works in some cases, but not in all. I cannot find the origin.

 

Check the screencast http://screencast.com/t/JkA565EqbhP

 

From what I can see in the database also, the values are copied to one of the variant records, but not to the one created through the interface. Could there be an issue with the interface that does not create the Category Field Values records IF the value is the same across all variantas AND there is no record there? Nonetheless, it is generating some confusion.

 

Best Regards,

Nuno

 
Nuno Aguiar
Reply

Hi Viktor,

 

After some further testing I believe I found the bug - Product Category fields:

  • At first the field was "changable" on a variant level
    • The DB record is inserted and updated
  • After some client's input we set that field (value) to be the same across variants
    • If we change the (main) product, the variant records are updated
  • Then we have to update some fields that were empty/null so far
    • There was no record in the database
    • We update the (main) product field
    • Dynamicweb understands this field is the same across variants, so does not create the BD record in the ProductCategoryFieldValues table (if it already exists, it does update)

 

The problem in that now the interface confuses the user (check the screencast provided above).

Another issue is that when you're on the detail page of the variant (not the product), the tags reflect the DB values only (don't consider the fields/variant/language behaviour), so we are getting some empty values.

 

I believe that Marco Santos is experiencing the same issue but on the API level. If I am not mistaken the same API method is being used to produce the template tags.

 

Hope it clarifies the issue.

 

Best Regards,

Nuno

 
Oleg Rodionov
Reply

Hi all,

 

New TFS 16547 has been submitted against the issue.

Nuno, thanks for cooperating!

 

BR,

Oleg
 

 
Nuno Aguiar
Reply

Hi Oleg,

 

Please let us know whenever there's a planned release for it. We have a customer experiencing problems with it.

 

Best Regards,

Nuno

 

You must be logged in to post in the forum