Copied to clipboard

Flag this post as spam?

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


  • Benjamin Howarth 305 posts 771 karma points c-trib
    Sep 23, 2019 @ 14:22
    Benjamin Howarth
    0

    Bug in data truncation on cmsPropertyData

    When setting up variants, the datatype persists values to the dataNvarchar field in cmsPropertyData. In Umbraco 7.15 this is limited to 500 chars, and if you have a lot of variants, bugs out quickly due to a LOT of whitespace being inserted.

    Two suggestions:

    1. persist to dataNtext instead
    2. apply whitespace minification upon serialization

    One variant on one product yields the following JSON in my cmsPropertyData table, and whilst I've manually upped the char limit on the column to be nvarchar(MAX), it is far from an ideal solution.

    {    "variants": [      {        "id": "cfb327e6-f09a-f0f3-01c1-7a38e39ec34b",        "documentTypeAlias": "variant",        "validation": {          "holesInVariants": false,          "duplicatesFound": false        },        "properties": {          "stock": "",          "productName": "",          "sku": "TESTSKU1",          "priceJMD": "19.99",          "umbracoUrlName": "",          "umbracoUrlAlias": [],          "umbracoInternalRedirectId": "",          "umbracoRedirect": "",          "umbracoNaviHide": "0"        },        "combination": [          {            "name": "Blue",            "id": 5856,            "groupName": "Colour",            "groupId": 5804          }        ]      }    ]  }
    
  • Matt Brailsford 2300 posts 11175 karma points MVP 6x c-trib
    Sep 23, 2019 @ 14:32
    Matt Brailsford
    0

    Hi Benjamin,

    You're on fire today 😁

    That is one I have seen before and I have recommended people change the column def to nvarchar(MAX) as a workaround. Essentially I think it's more of a core issue as the prop editor just declares it's value type as JSON https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/master/Source/TeaCommerce.Umbraco.Configuration/PropertyEditors/VariantEditorPropertyEditor.cs#L12 but Umbraco appears to store that in the nvarchar field. I also can't quite recall if there was a period in time when the col used to be nvarchar(MAX) but was lowered, but I can't be sure on that one.

    I think would could probably look to see if we can explicitly choose NText but we'd probably need to a) review if this had any issues with the data but also b) ensure there is an upgrade path such that existing values get copied across.

Please Sign in or register to post replies

Write your reply to:

Draft