Arrays
Last updated
Last updated
Array Option for Part Reference and String Attributes has been added to support configuration of modular products, like closets and sectional furniture, where users can select multiple options, arrange them, and see them in that order in physical space.
An `Array Option` option has been added to the existing Part Reference and String attributes. When turned on, the maximum number of values may be set, the corresponding Asset type (for part reference), and the available values (using Item names, tags, or free-entry strings).
Add the new attribute to your Catalog Item as normal. The configurator preview will display the new Array component where these available options may be selected up to the ‘Max. Items’ limit:
Notice: Multiple options of the same value may be added to the array:
Use drag-and-drop to sort the options:
Using Catalog Item Rules, validation and constraints are added using the Array index. For example, if the first seat (0) is `Green seat`, the second seat (1) must be `Red Seat`. The configurator will automatically set the value based on this rule:
The `Asset` setup for the item is similar to a typical setup except with a model placeholders or nulls for each item in the array. Position each in the desired location.
To configure logic add the Array attribute and use the `Set Model` action targeting each model placeholder or null using the index numbers:
Product configurations can be saved and restored using the player's built-in Share functionality or the configuration API:
Array Attributes in the Player API
When utilizing the Player API to interact with array attributes, they will behave largely the same as other attributes with a few notable differences:
When using configurator.getDisplayAttributes() the type property will have a value “Array” for any attribute with Array Option = TRUE. This is true for both Part Reference and String attributes.
If type = “Array”, then a pair of properties appear under on the attribute’s entry:
of - Property containing an object that defines the types of values in the array with properties type and, if type = “Asset”, another property assetType is present to further define the values.
maxLength - Property containing the value from Max. Items on the platform
When using configurator.getConfiguration(), the properties corresponding to the array attributes will contain arrays of the values. An attribute with no selections made will yield an empty array in its property.
When using configurator.setConfiguration() for array attributes, pass an array of desired length, with each element set to the proper value. It will update both the number of items and the value for each item of that attribute.