Managing Configuration Arrays and Sets

Overview

Array attributes are used to group multiple, scalar attributes using a single data structure, and are available both for the selection and configuration process. Similar to other configuration attributes, you can create array attributes at all levels in the configuration hierarchy, but can delete them only at the level of the hierarchy in which they were created. You can create array attributes for all the available data types.

When a default value is set for an array attribute, the value is applied to all elements of the array. It is not possible to set default values for attribute elements at the attribute definition level. When you want to set different default values for the various elements of an array, you must define a recommendation rule.

When you create an array attribute, it is automatically associated to a default set, which can then later be changed to a custom set. Array attributes are placed in Sets for easier and more intuitive creation of configuration flows. This is optional; if you do not associate the set with a size, the system assumes that the size is always 1 on the user side.

ClosedCharacteristics of Array Attributes & Sets

While defining array attributes, you must use the Set Size attribute to define the size of the array. A Set Size attribute is a special kind of an integer attribute that has been marked as an Array Control attribute. If you do not select the set size attribute, a warning appears that the array created will always be of size ”1” until a size attribute is associated.

While creating array control attributes and array attributes, make sure they are ordered such that the control attribute has a lower order number than the array attribute it drives. This ensures that the rules fired have the desired effect: rules always fire based on the order of the attributes.


ClosedArray Control Attribute

An array control attribute is used as the Set Size attribute. They are used to define the size of the array. An array control attribute is a special kind of integer attribute that has been marked as an Array Control attribute. When you create an attribute with an integer data type and a text field attribute type, there will be a field called Array Control attribute. Checking this box marks the attribute as available for use as a Set Size Attribute for use in Array Sets.

Characteristics of Sets Associated with the Size Attribute
  1. If you associate an array attribute to a set after having already selected a Set Size attribute, the associated set’s size attribute is shown under the General tab of the Array Attribute Editor.
  2. You can create multiple sets at the same level and associate them to a single Set Size attribute.

    When the same size control attribute is assigned to multiple array sets, the size of the arrays can only be controlled by directly modifying the size attribute. The add and delete (+/-) buttons will be disabled on the Configuration UI for array sets with a size control attribute that is assigned to multiple array sets.

  3. The Set Size attribute fields (in the Set Properties tab, or the Configurable Array Set Editor page) displays only those integer attributes that have been marked as Array Control Attributes and have a range validation from 1 to 50.

Administration

ClosedSetting Up Array Sets Watch Video  Video icon

  1. ClosedNavigate to the Configurable Array Sets Administration List page.

    1. Click Admin to go to the Admin Home Page.

    2. Click Catalog Definition in the Products section.

      The Supported Products page opens.

    3. In the Navigation column, select Attributes and then click List.

      The Attributes Administration List page opens.

    1. Click List Array Sets.

      The Configurable Array Sets Administration List page opens.

  2. Click Add.

    The Configurable Array Set Editor page opens.

  3. Enter a Name.
  4. Select the appropriate Size attribute.

    Remember that the Array Control attribute is used to determine the Size attribute.

    When the same size control attribute is assigned to multiple array sets, the size of the arrays can only be controlled by directly modifying the size attribute. The add and delete (+/-) buttons will be disabled on the Configuration UI for array sets with a size control attribute that is assigned to multiple array sets.

  5. Choose the Display Type: Horizontal, Vertical or Tabbed

    See the Set Properties tab for more details.

  6. Select the display of labels in the Label Option menu. The available options are:

    For Horizontal or Vertical display types only:

    1. Display Only First Label

    For Tabbed display types only:

    1. Display Both Labels and Indices
    2. Display Only Labels
  7. Define a Prefix and/or Suffix for each index shown within in each set.

    This allows you to create a group label for each iteration of the array attributes within the set.

  8. In the Set Association Information section, a list of unassociated and associated attributes is displayed.

    You can move the attributes from the Unassociated to the Associated section, or vice-versa, using the right and left arrow buttons.

  9. Click Apply to save the changes and remain on the current page, or click Update to save the changes and return to the Attributes List page.

ClosedSetting Properties Tab

The Set Properties tab contains different options for editing the array attributes. In the Text Attribute Editor page.

  1. ClosedNavigate to the Text Attribute Editor page.

    1. Click Admin to go to the Admin Home Page.

    2. Click Catalog Definition in the Products section.

      The Supported Products page opens.

    3. In the Navigation column, select Attributes and then click List.

      The Attributes Administration List page opens.

    1. Click the name of an attribute with Yes in the Array Type column.

      The Text Attribute Editor page opens.

  2. Click the Set Properties tab.
  3. In the Available Sets section, select or edit the Array Set.
  4. Choose the Size Attribute for the array attribute.

    This drop-down lists all the integer attributes available in the configured product, that have been marked as Array Control Attribute.

    For more information, see the topic Text, Float, and Integer Attributes.

  5. Choose the Display Type. The available display types are:
    1. Horizontal: Layout shows indices in the first row above each column. The data is arranged in columns

      Horizontal Array example

    2. Vertical:  Layout shows indices in the first column of the table. The data is arranged in rows.

      Vertical Array example

    3. Tabbed:  This layout shows the attributes for each array element in a separate tag. The data is arranged in tabs.

      Tabbed Array example

  6. Select the display of labels in the Label Option menu. The available options are:

    For Horizontal or Vertical display types only:

    1. Display Only First Label

    For Tabbed display types only:

    1. Display Both Labels and Indices
    2. Display Only Labels
  7. Add a Prefix or Suffix, if desired.
  8. Click Apply to remain on the current page, or click Update to return to the Attributes List page.

    The display properties of a set can only be controlled from the Set Properties tab and not from the template.

    In the Set Association Information section, a list of the associated attributes is displayed. These are not editable. To add additional array attributes to the set, use the Array Attribute Editor page.

Troubleshooting

ClosedSystem throws an error


Notes

Create the array set before visiting the Set Properties tab of the array attribute. Ensure the array control attribute is in the same group as the array set and verify it is not hidden.

Create arrays in this order: 

  1. Create the array control attribute
  2. Create the array set
  3. Create the array attributes
  4. Add the attributes to the array set.

For more information on attribute ordering, see the topic Configuration Attributes Overview.

See the topic Array Best Practices for more information.

The rules run based on the attribute ordering on the Configurable Attributes Administration List page. Ensure that your Set Size attributes are placed (ordered) before the Array attributes for the rules to run effectively.

Configuration data in Commerce is stored as a tilde-delimited string. The array values within this string are delimited by $,$.

For example, for a configuration array foobar that is of single-select menu type (possible values are red[r], green[g], or blue[b]), the string format looks like this:

&endash; foobar~foobar~r$,$r$,$r$,$g

This means that foobar[0] = foobar[1] = foobar[2] = "r". foobar[3] = "g"

The Size Attribute must be marked as the Array Control Attribute upon attribute creation.

Multi-select menus are not possible in arrays.

Related Topics

Related Topics Link IconSee Also