Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I added a few fields to the variant (text boxes and media picker) and all seem to work fine. I've since added a new field (check box) which appears to save fine in the back office - but when trying to get the value in my view it is always 'false' regardless of what it is in the back office.
Is there anything you know of that would cause this? I am getting bool/checkbox values ok from fields at the product level just not this one on the variant.
Another thing (though I can't be sure this was the cause) - I tried deleting the property from the document type and recreating it with a different name. Doing that seems to have caused some products to loose the variants that were set up for them - is this possible? I'm now reluctant to change anything in the variant doc type in case this happens.
We will have a look at the variants disapearing when you change/remove a property.
As for the checkbox. I presume you fetch the property as a bool. Could you try fetching it as a string instead? Then you might get a 0 and 1 instead. We might have to have a look at the bool code as Umbraco saves these data as zeroes and ones.
Yes I tried fetching as a bool and a string, neither worked (don't remember exactly what the string value was, I don't have the project here right now).
Another related question - if I now create a new property for that variant do I have to go through and save every product again for that property to be created for each one? or if I publish all would it automatically create them all with the default value of the property?
If you create a new property all old variant will have a null value in that property field, as it's not filled out yet. Be sure to check for that in your code, when you use the new properties.
Just checking in to see if you had any updates on this?
To confirm I've tried fetching as bool (returns false, even when ticked in the back office), and string (returns "False").
Have you tried to get the demo vanilla webshop from GitHub and tried if it works there? Just to be sure if there is a bug in the API of Tea Commerce or there is a bug in your implementation code.
I've just tested a few property types on variants on a fresh install with the starter kit shop. Here's what I found.
Textbox fields work ok.
Check boxes always return false (tried getting as bool and string).
Numeric fields seem to always return 0 (fetched as int).
Radio button list also creates one single list id/name for all variants, so you can only select one value across all of them (rather than one val per variant).
From my existing project I know that the image selector works ok on the variant.
I can hack a work around using the text box for the time being, for what I need to do, but it seems there's quite a problem with this.
I sent you an updated dll yesterday. Hope you get a chance to check it out.
Also we're working hard on a new release of Tea Commerce with a better and faster data provider framework.
Thanks. I ended doing things differently and not needing that in the end but at least I found a bug! Will try to test the fix anyway when I get a chance.
I hit this problem as well with a boolean field on my variant. My workaround is to get the specific IPublishedProperty object I need from the variant object and then test it's DataValue field as this is correctly "1" or "0", even when the Value field is wrong, e.g:
bool variantFieldValue = false;
VariantPublishedContent variant = TC.GetVariant(myStoreID, myProductNode, myVariantIdentifier, true);
if (variant != null)
IPublishedProperty myVariantProperty = variant.GetProperty("myVariantField");
if (myVariantProperty != null)
variantFieldValue = (myVariantProperty.DataValue.ToString() == "1");
Hope this helps someone,
Should be fixed in Tea Commerce 3.1.3 :)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted