Copied to clipboard

Flag this post as spam?

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


  • Kyle Eck 130 posts 280 karma points
    Dec 28, 2021 @ 02:39
    Kyle Eck
    0

    Vendr Complex Data Structure Creation

    Matt,

    As you know I have been working to integrate CMS Import with Vendr complex variants and had a few questions.

    I have the following raw data structure generated on the fly from a csv file:

    {
        "layout":{
            "Vendr.VariantsEditor":[
                {
                    "contentUdi":"umb://element/0da576e5fc7445bd9d789c5ee9fe9c54",
                    "config": {
                        "attributes": {
                            "size": "lg",
                            "color": "blue",
                            "fit": "mens"
                        },
                        "isDefault": true
                    }
                },
                {
                    "contentUdi":"umb://element/c6e23e8137d24b409bb5ef41bdb705b9",
                    "config": {
                        "attributes": {
                            "size": "xl",
                            "color": "green",
                            "fit": "mens"
                        },
                        "isDefault": false
                    }
                }
            ]
        },
        "contentData":[
            {
                "contentTypeKey":"aca1158a-bad0-49fc-af6e-365c40683a92",
                "udi":"umb://element/0da576e5fc7445bd9d789c5ee9fe9c54",
                "sku":"SKU-001",
                "description":"Variant 1 description"
            },
            {
                "contentTypeKey":"aca1158a-bad0-49fc-af6e-365c40683a92",
                "udi":"umb://element/c6e23e8137d24b409bb5ef41bdb705b9",
                "sku":"SKU-002",
                "description":"Variant 2 description"
            }
        ],
        "storeId": "7b2e6800-2e1e-4c51-89cc-cf5ded4e8566"
    }
    

    Beyond that when you create this for a variant within Vendr do you have a specific class you use to hold this information? Essentially the commas are tripping the CSV file up so instead of having the entire thing in one entry, the commas split this into multiple fields, thus making my csv file invalid.

    Unfortunately I treat this as one giant string in my csv, it is wrapped with quotes but the commas are not being included in the string. Seems simple i know, been bothering me for days.

    I am fairly close to getting this working on v8 as i think this may be the last hurdle i need to jump through. Besides taking a JValue to JObject in CMS Import.

    Thanks.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 04, 2022 @ 09:27
    Matt Brailsford
    0

    Hi Kyle,

    We have a VariantEditorLayoutItem which represents the data inside the layout.Vendr.VariantsEditor collection, but not for the whole thing as this is based on Umbraco's block editor data structure. Generally speaking, anything in the contentData structure would be considered an IPublishedElement but not sure if this helps.

    Without knowing the structure of the CSV, it sounds like you might need some additional escaping around the commas.

    Matt

  • Kyle Eck 130 posts 280 karma points
    Jan 04, 2022 @ 10:44
    Kyle Eck
    0

    Matt I’ve gotten around the comma issue for now. But am wondering if the I could simply consider the vendr variant editor a block editor from Umbraco for simplicity sake?

  • Kyle Eck 130 posts 280 karma points
    Jan 04, 2022 @ 10:54
    Kyle Eck
    0

    Sorry on mobile, Essentially right now I produce everything from end to end with the Vendr variant editor.

    With that I get all the way through to where CMS Import wants to physically map the raw data I provided to a field on the doc type.

    At this point it hits my Parsimg method but the value is blank, which I am working with Richard on.

    However, if I could generalize the raw data structure into something Umbraco knows about ootb I was curious how this would change things.

    Thanks.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 04, 2022 @ 11:00
    Matt Brailsford
    0

    Hmmm, I'm not entirely sure.

    The problem with the block list is that it's designed to be custom so things like the storeId and the layout structure is custom to the variants editor, where as the surrounding elements are block list defined.

    I'm not entirely sure what classes Umbraco has for these but if you do find them, I'd just make sure you don't loose the custom stuff Vendr adds.

    Matt

  • Kyle Eck 130 posts 280 karma points
    Jan 04, 2022 @ 11:08
    Kyle Eck
    0

    Well so your Vendr data structure is in fact a Vender.VariantEditor correct?

    I need to tell CMS Import what kind of field it is when Parsing which it currently does…

    My earlier comments were more of a “let’s see if we can get this to work another way”

    Thanks for your continued help with this.

    I’m sure I’ll be asking other questions.

Please Sign in or register to post replies

Write your reply to:

Draft