Commerce Composer widget properties
By default, the widgets available for use with the Commerce Composer tool can include properties that a developer can define, or Management Center user can configure. When we are creating a custom widget, we can define your widget to include any of these properties, or you create our own custom properties. By default, Commerce Composer widgets include a variety or properties. These properties can display to Management Center users or be hidden from these users. We can use widget properties for multiple purposes:
- To provide users with the capability to control the data that shows within a widget, and control how a widget displays in the storefront. For example, we can define widget orientation property for a widget so users can determine whether the widget displays content horizontally or vertically.
- To control more display behavior and functional or a widget, that users are not provided the capability to control. For example, we can define a widget restriction group property for a widget to determines which layout template slots that users can include the widget within when they are creating a layout.
- To identify the logic and assets required for the widget to function. For example, we can use a basic name-value pair property to identify a JavaScript file that a widget must include for the widget to function properly.
When we are creating a widget, use the storefront assets, registered definition XML, and Management Center definitions of existing widgets to help you define properties for our widget.
- Use the object and properties view definitions for existing Commerce Composer widgets to model the Management Center display of the properties for our widget. For more information about defining the Management Center assets for a widget, see Adding Management Center support for a Commerce Composer widget.
- Use the storefront asset definitions for existing widgets to model the storefront display and usage of the properties for our widget. For example, the storefront presentation of the orientation of widgets is defined within a UI provider JSP file. For more information about defining the storefront presentation, function, and assets for a widget, see Defining storefront assets for a Commerce Composer widget
- Use the definition XML of existing widgets to help you model the definition XML of basic name-value pair properties for our widget. Basic widget name-value pair properties are stored within the PLWIDGETNVP database table. For more information about creating the definition XML for a widget, see Registering a Commerce Composer widget. For properties to be configurable by business users, define the Management Center display and support for the property within the properties view for our widget.
- If the properties are more complex than a name-value pair property, or the values for the properties are not stored within the PLWIDGETNVP, define a widget manager class to handle storing the value for the properties. Review the widget manager classes for existing widgets to help you define how your widget manager class must handle properties that are more complex than basic name-value pairs. For more information about creating a widget manager class, see
Defining a Commerce Composer widget manager class.
When we are defining the properties view definition for the configurable properties to include in the Commerce Composer tool, we can define the properties to display in different ways. For instance, we can define the properties so that users can select the value for the properties using radio buttons, check boxes, combination boxes, and more. See Examples: Adding Management Center properties view widgets. After you define the behavior of the properties for our widget, the values for the properties can be specified using any of the following options:
- If you define the properties to be editable within Management Center, business users can configure the properties for the widget within the Commerce Composer tool.
- If the properties are defined within the definition XML for the widget, we can use the Data Load utility to update the definition XML with values for the properties.
- If the property is not defined to be editable within Management Center, we can define a value for the widget within the object definition for the widget. We can also define default values for properties that are editable in Management Center within the object definition file for a widget. Users can set a different value with the Commerce Composer tool, and administrators can set a different value with the Data Load utility.
Note: All widgets include a configurable property Widget name. This is a name for the user to set to help the user identify the widget within a specific layout or layout template. By default, the value for this name is the display name of the widget set for the value of the WIDGETDISPLAYNAME column of the PLWIDGETDEFDESC database table. This property is not set within the definition XML of a widget or by the widget manager class. The value can be changed within the Commerce Composer tool, or by updating the ADMINNAME column of the PLWIDGET. database table.
- Examples: Adding Management Center properties view widgets
By reviewing code samples that create some common properties view widgets, we can better understand how to implement these widgets in our own properties views. The code samples also illustrate how to make a required property and how to add an enablement condition for certain properties.