Copied to clipboard

Flag this post as spam?

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


  • Richard B 14 posts 124 karma points
    Aug 16, 2016 @ 10:59
    Richard B
    0

    Can't access one specific variant property

    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.

  • Rune Grønkjær 1372 posts 3103 karma points
    Aug 17, 2016 @ 06:09
    Rune Grønkjær
    0

    Hi Richard,

    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.

    /Rune

  • Richard B 14 posts 124 karma points
    Aug 18, 2016 @ 09:26
    Richard B
    0

    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?

  • Rune Grønkjær 1372 posts 3103 karma points
    Aug 18, 2016 @ 11:25
    Rune Grønkjær
    0

    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.

  • Richard B 14 posts 124 karma points
    Aug 22, 2016 @ 15:17
    Richard B
    0

    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").

    Thanks

  • Anders Burla 2560 posts 8256 karma points
    Aug 24, 2016 @ 12:16
    Anders Burla
    0

    Hi Richard

    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.

    https://github.com/TeaCommerce/Starter-kit-for-Umbraco

    Kind regards

    Anders

  • Richard B 14 posts 124 karma points
    Aug 26, 2016 @ 12:13
    Richard B
    0

    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.

  • Rune Grønkjær 1372 posts 3103 karma points
    Aug 30, 2016 @ 06:25
    Rune Grønkjær
    0

    Hi Richard,

    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.

    /Rune

  • Richard B 14 posts 124 karma points
    Aug 31, 2016 @ 18:14
    Richard B
    0

    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.

  • Scott Meikle 28 posts 228 karma points
    Nov 25, 2016 @ 14:04
    Scott Meikle
    0

    Hi folks,

    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,

    Scott

  • Anders Burla 2560 posts 8256 karma points
    Nov 28, 2016 @ 10:03
    Anders Burla
    0

    Should be fixed in Tea Commerce 3.1.3 :)

Please Sign in or register to post replies

Write your reply to:

Draft