1. Adding properties to Commerce items

Work with custom child views

Version:

Sitecore XC lets you extend the properties associated with a Commerce item, and to make those properties available to other Commerce items.

Note

You cannot make any changes to a Commerce item that has already been published. If you want to customize a Commerce item, you must create a new entity version and make the relevant changes in the new version.

Add a child view to a Commerce item

You can add a child view to any Commerce item.

For example, to add a custom child view:

  1. Open the Merchandising dashboard.

  2. In the Catalogs section, click a catalog.

  3. On the catalog Details page, in the Summary section, in the drop-down menu, click Add View.

  4. In the Add View window, enter an internal name and a display name for the child view.

  5. On the catalog Details page, open the drop-down menu in the new child view and click Add Property.

  6. In the Add Property window, enter an internal name and a display name for new property. Then in the drop-down menu, click one of the following data types:

    • String

    • DateTimeOffSet

    • Decimal

    • Integer

    • Boolean

  7. Depending on the data type of the new property, you can optionally configure a constraint on the permitted values for the property. 

    • To configure a maximum-minimum constraint on properties of type integer or decimal, in the drop-down menu, click Add Min-Max Constraint.

    • To specify a set of permitted values for properties of type string , in the drop-down menu, click Add Selection Option Constraint.

Convert an existing custom child view to a Composer template

After you have added a custom view to a Commerce item, you can convert the custom child view to a Composer template, to make it available to other Commerce items.

To convert an existing custom child view to a Composer template:

  1. On the Commerce item Details page, in the custom child view section, in the drop-down menu, click Make Template .

  2. In the Make Template window, specify an an internal name and a display name for the Composer template.

  3. In the left navigation pane, to open the Composer dashboard, click Composer.

  4. Verify that the new Composer template is listed in the Templates section.

Create a Composer template

You can create a Composer template directly from the Composer dashboard.

To create a new Composer template:

  1. In the left navigation pane, to open the Composer dashboard, click Composer .

  2. In the Templates section, in the drop-down menu, click Create Template.

  3. In the Create Template window, specify the following fields:

    • Name - an internal name for the Composer template.

    • Display Name - an external name for the template in the Composer dashboard.

    • View Name - an internal name for the custom child view

    • Display View Name - an external name for the child view in the Commerce item Details page

  4. On the Composer dashboard, in the Templates section, click the new template in the Templates section.

  5. On the template Details page, add one or more custom properties.

Add a child view from a Composer template

You can add a child view to a Commerce entity from an existing Composer template. When you add a child view from the Commerce entity menu, you can make changes to the child view without affecting the original Composer template.

To add a custom child view from a template:

  1. On the Details page of the Commerce item, in the Summary section, in the drop-down menu, click Add View From Template.

  2. In the Add View From Template window, click the Composer template in the drop-down list.

Apply a Composer template to multiple Commerce items

You can apply a custom child view to multiple Commerce items, at different levels of granularity. For example, you can apply a custom child view to all Commerce items of a certain type.

Note

When you add a child view from a template on the Composer dashboard, you cannot add or remove properties from the child view in the Commerce item. You must make changes to the template itself, and those changes apply to all Commerce items that inherit the child view.

To apply a custom child view to all Commerce items of a specific type:

  1. On the Composer dashboard, in the Templates section, click the template you want to apply. 

  2. On the template Details page, click the link icon. 

  3. In the Link To Entities window, select all of the Commerce item types that you want to inherit the custom child view.

Apply a Composer template to specific sellable items

You can also apply a custom child view to a subset of specific sellable items by matching tags or item definitions applied to those sellable items.

Note

For a custom child view to be visible from the Sitecore Content Editor, you must apply the Composer template to items using Associate item definitions. Composer templates applied using any other methods ( for example, using tags or linked to entities) are not displayed in the Sitecore Content Editor.

To apply a custom child view to a subset of sellable items: 

  1. On the Composer dashboard, in the Templates section, click the template you want to apply.

  2. On the Details page , click the tag icon. 

  3. In the Manage Tags window, enter the tags you want to associate with the Composer template. You must associate the same tag with a sellable item for that sellable item to inherit the custom child view.

  4. Alternatively, on the template Details page, click the + icon.

  5. In the Associate To Item Definitions window, in the drop-down list, to obtain a list of valid item definitions, click a catalog.

  6. Check all of the item definitions you want to associate with the Composer template. Any sellable item in the catalog that has the same item definition inherits the custom child view.

Remove a child view from a Commerce item

You can remove a custom child view from a Commerce item after you have added it, but the method you use depends on whether the child view was added directly to the Commerce item, or indirectly using a template on the Composer dashboard.

To remove a child view from a Commerce item:

  • If you added the child view to the Commerce item directly, either by creating the child view in the Commerce item or selecting a Composer template from within the Commerce item, click Remove View in the drop-down menu in the child view. 

    Note

    You can remove the child view even after you have modified the child view properties.

  • If you added a child view to a Commerce item from a template on the Composer dashboard (for example, by associating the template with a set of item definitions or tags), delete the relationship from the Composer dashboard (for example, by removing one or more item definition or tag associations from the template).

Important

If you add a child view from a template on the Composer dashboard and then make modifications to the child view (for example, by adding values to one or more properties in the view), you cannot remove the child view from the Commerce item.

If you have suggestions for improving this article, let us know!