UI Config Files

Customizing the UI in Umbraco Commerce.

With Umbraco Commerce, there are minimal rules about what information you are required to record about an Order, however, this does pose a problem for how we provide a User Interface for managing carts and orders when we don't know exactly what properties you are going to be recording.

In order to allow this flexibility whilst still providing the ability to view and manage carts and orders in the backoffice, Umbraco Commerce supports a number of UI config files to map Order/Order Line Properties to its UI elements.

Supported UI Config Files

The configuration files supported by Umbraco Commerce are.

  • cart.list.config.json - Cart list view configuration.

  • cart.editor.config.json - Cart editor view configuration.

  • order.list.config.json - Order list view configuration.

  • order.editor.config.json - Order editor view configuration.

If there are no cart config files defined, then Umbraco Commerce will fall back to the order config files.

Assigning a UI Config File to a Store

To assign a UI config file to a Store, this is done by file name convention. This is where configs are looked for in App_Plugins/UmbracoCommerce/config with the following file name format {storeAlias}.{entityType}.{viewType}.config.json. If no store-specific file is found, it will fallback into the default {entityType}.{viewType}.config.json.

Cart/Order List Config Files

With these configuration files, you can customize the columns displayed in the Cart/Order list view.

Example Cart/Order List Config File

{
    properties: [
        { alias: "color", header: "Color", placeholder: "Undefined" },
        { alias: "size", header: "Size", placeholder: "Undefined", align: "right" }
    ]
}

The following properties are supported:

Properties configured to display in the list view will appear in order, after the cart name column.

Cart/Order Editor Config Files

With these configuration files, you can customize the Cart/Order Editor interface to suit your particular needs.

Example Cart/Order Editor Config File

An example of an Order Editor config file would look something like this:

{
    orderLine: {
        properties: [
            { alias: "color", label: "Color", isReadOnly: true, showInOrderLineSummary: true },
            { alias: "size", label: "Size", isReadOnly: true }
        ]
    },
    customer: {
        // Firstname, Lastname and Email are already known
        company: { alias: "company", label: "Company Name" },
        taxCode: { alias: "taxCode", label: "Tax Code" },
        telephone: { alias: "telephone", label: "Telephone" },
    },
    billing: {
        addressLine1: { alias: "billingAddressLine1", label: "Street Address Line 1" },
        addressLine2: { alias: "billingAddressLine2", label: "Street Address Line 2" },
        city: { alias: "billingCity", label: "City" },
        zipCode: { alias: "billingZipCode", label: "Zip Code" },
        telephone: { alias: "billingTelephone", label: "Telephone" },
        // Country and Region are already known
    },
    shipping: {
        enabled: true,
        sameAsBilling: { alias: "shippingSameAsBilling", label: "Same as billing", trueValue: "1", falseValue: "0" },
        firstName: { alias: "shippingFirstName", label: "First Name" },
        lastName: { alias: "shippingLastName", label: "Last Name" },
        addressLine1: { alias: "shippingAddressLine1", label: "Street Address Line 1" },
        addressLine2: { alias: "shippingAddressLine2", label: "Street Address Line 2" },
        city: { alias: "shippingCity", label: "City" },
        zipCode: { alias: "shippingZipCode", label: "Zip Code" },
        telephone: { alias: "shippingTelephone", label: "Telephone" },
        // Country and Region are already known
    },
    notes: {
        customerNotes: { alias: "comments", label: "Customer Comments" },
        internalNotes: { alias: "notes", label: "Internal Notes" }
    },
    additionalInfo: [
        { alias: "ipAddress", label: "IP Address", isReadOnly: true }
    ]
}

The Cart/Order Editor config file is broken up into a series of sections, each of which relates to a particular section of the Cart/Order Editor User Interface.

Order Line Config Options

The Order Line config block configures which Order Line properties should be viewable and/or manageable within the Cart/Order Editor UI. For each Order Line Property, you can provide the following options:

Properties configured to display in the Order Line Summary will be displayed inline next to the "Order Lines SKU" as follows:

Where there are editable Order Line Properties for an Order Line, a pencil icon is displayed next to the Order Lines Product name which when clicked will open out the Order Line Property editor interface for that Order Line.

Customer Config Options

The Customer config block configures which Cart/Order properties relate to a Cart/Orders customer information. The following properties are supported.

Any missing property definition in this config block will disable that property from displaying/being editable.

For each property, the following config options are available:

A fully configured Customer config block will produce a Customer summary like so:

Clicking the Customer Details Edit button will display an editing interface like so:

Billing Config Options

The Billing config block configures which Cart/Order properties relate to a Cart/Orders billing information. The following properties are supported.

In addition to these properties, the order.PaymentInfo Country/Region will be associated with the billing address.

Any missing property definition in this config block will disable that property from displaying/being editable.

For each property, the following config options are available:

A fully configured Billing config block will produce a Billing Address summary like so:

Clicking the Customer Details Edit button will display an editing interface like so:

Shipping Config Options

The Shipping config block configures which Cart/Order properties relate to a Cart/Orders shipping information. The following properties are supported.

In addition to these properties, the order.ShippingInfo Country/Region will be associated with the shipping address.

Any missing property definition in this config block will disable that property from displaying/being editable.

For each property, except enabled or sameAsBilling, the following config options are available:

For the sameAsBilling property, the following config options are available:

A fully configured Shipping config block, where the sameAsBilling property is false, will produce a Shipping Address summary like so:

Where as, a fully configured Shipping config block, where the sameAsBilling property is true, will produce a Shipping Address summary like so:

Clicking the Customer Details Edit button will display an editing interface like so:

If the sameAsBilling toggle switch is toggled, the appropriate Cart/Order property will be toggled between the configured Properties true/false values, and the editor interface will be collapsed like so:

Notes Config Options

The Notes config block configures which Cart/Order properties relate to a Cart/Orders note information. The following properties are supported.

Any missing property definition in this config block will disable that property from displaying/being editable.

For each property the following config options are available:

A fully configured Notes config block will produce an editor interface like so:

Additional Info Config Options

The Additional Info config block configures any other Cart/Order properties you wish to display in the Cart/Order editor interface in the Additional Info section. For each Order Property to display you can provide the following options:

A fully configured Additional Info config block will produce an Additional Info summary interface like so:

Clicking the Additional Info Edit button will display an editing interface like so:

Custom Cart/Order Editor View

If you wish to entirely replace the Cart/Order Editor view with a custom implementation you can create a Cart/Order Editor Config file with a single view config option which points to the path of an alternative AngularJS view file to use for editing the Order.

{
    view: '/app_plugins/myplugin/views/ordereditor/ordereditor.html'
}

Last updated