Skip to content

Settings using Multiple Textstrings doesn't work #743

@skttl

Description

@skttl

Which component is this issue related to?

Umbraco Commerce (Core)

Which Umbraco Commerce version are you using? (Please write the exact version, example: 10.1.0)

16.2.1

Bug summary

I've set up some discount providers, with a settings model using Multiple Textstrings like

    [DiscountRewardProviderSetting(
        Label = "Tilladte PLU'er",
        SortOrder = 0,
        Key = "allowedPlus",
        Description = "Angiv hvilke PLU'er gavekort skal kunne betale for. Angives ingen PLU'er kan gavekort betale for alle PLU'er, pånær de der er angivet i udelukkede PLU'er.",
        EditorAlias = "Umbraco.MultipleTextstring",
        EditorUiAlias = "Umb.PropertyEditorUi.MultipleTextString",
        EditorConfig = "{\"min\":0,\"max\":0}"
    )]
    public IEnumerable<string> AllowedPlus { get; set; } = Enumerable.Empty<string>();

    [DiscountRewardProviderSetting(
        Label = "Tilladte PLU'er2",
        SortOrder = 0,
        Key = "allowedPlus2",
        Description = "Angiv hvilke PLU'er gavekort skal kunne betale for. Angives ingen PLU'er kan gavekort betale for alle PLU'er, pånær de der er angivet i udelukkede PLU'er.",
        EditorAlias = "Umbraco.MultipleTextstring",
        EditorUiAlias = "Umb.PropertyEditorUi.MultipleTextString",
        EditorConfig = "{\"min\":0,\"max\":0}"
    )]
    public string AllowedPlus2 { get; set; } = string.Empty;

Note the second one, I was just trying to see how it would work with a simple string. The CMS documentation instructs to use a string delimited by newlines when setting the value. https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/multiple-textbox#add-values-programmatically

When saving the discount, both settings are sent to the backend as arrays of strings:

Image

They both also come back as an array containing a single string delimited by newlines - and with quotation marks.

Image

Is this a bug in Commerce - or have I done something wrong?

Specifics

No response

Steps to reproduce

Create a discount provider, with a setting using Multiple Textstrings as shown above

Expected result / actual result

Expected to be able to use Multiple Textstrings for settings, but it messes up the value when I save.

Dependencies

No response


This item has been added to our backlog AB#55535

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions