Umbraco.Commerce.Issues icon indicating copy to clipboard operation
Umbraco.Commerce.Issues copied to clipboard

Unable to set JSON config for additionalInfo property

Open justin-nevitech opened this issue 6 months ago • 5 comments

Describe the bug I need to set some JSON in the config property to pass to a custom view for a property in the order editor config but it is not working. If I set this to a JSON value I get an error loading the config and if I set it to an encoded JSON string it errors when I try and edit the additional information section in the order (as it is expecting an object not a string).

Steps To Reproduce Steps to reproduce the behavior:

  1. Add the following to a custom order editor config in the additionalInfo section:
{
  "alias": "shippingStatus",
  "label": "Shipping Status",
  "view": "/App_Plugins/SimpleDropdown/simpleDropdown.html",
  "config": {
    "items": [
      {
        "id": 0,
        "value": "Not Shipped"
      },
      {
        "id": 1,
        "value": "Shipped"
      }
    ]
  }
}
  1. Try and edit an order and the page will fail to load with the error:
Server error: Contact administrator, see log for full details.
Failed to get order editor config

The full error I get is:

{
    "ExceptionMessage": "Unexpected character encountered while parsing value: {. Path 'additionalInfo[2].config', line 97, position 17.",
    "ExceptionType": null,
    "StackTrace": null
}

Expected behavior The custom property should load the editor config and pass the config to the view as JSON. I'm sure I had a working version of this with Vendr but that is going back a couple of years... I am following the instructions here but this doesn't specify what the JSON should look like:

https://docs.umbraco.com/umbraco-commerce/v/10.commerce.latest/key-concepts/ui-config-files#additional-info-config-options

Umbraco Commerce version: 13.1.6

justin-nevitech avatar Aug 15 '24 10:08 justin-nevitech