Load your widget into the database by using Data Load utility
In this lesson, you use the Data Load utility to register your new widget and have a store subscribe to your widget.
To use a widget to compose a page layout for a store, you must load the relationship between the widget and the store. A store must subscribe to a widget for that widget to be available for users to include the widget in a layout. You can use the generated CSV files and Data Load utility configuration files to help you load your widget information into the database.
For more information about loading widget information with the Data Load utility, see Registering a Commerce Composer widget.
For more information about the Data Load utility, see Overview of the Data Load utility.
Procedure
-
In a File Manager, go to the DataLoad\widget directory within your new
project directory.
If you created your new project directory at the top level in your workspace, the path to this directory can be workspace_dir\NewWidgetProject\DataLoad\widget.
-
In the widget directory, open the
registerWidgetdef.csv file for editing.
You use the registerWidgetdef.csv input file to load widget definition information to register your new widget within the Commerce Composer framework. You also use the file to have a store subscribe to the widget. A store must subscribe to a widget for the widget to be available for use in the Commerce Composer tool for that store. The registerWidgetdef.csv input file loads data into the PLWIDGETDEF and PLWIDGETDEFDESC database tables. The generated registerWidgetdef.csv input file includes information that you included in the JET pattern input XML file. You can update the CSV file to include more properties and information for your widget or edit the generated information.Ensure that the following columns within the CSV file are correctly specified:
- WidgetDefIdentifier
- The external reference name for the widget definition. You can use any name, but the name must be unique for the store. For example, ShoppingCartDetailWidget. The value for this parameter cannot include spaces or special characters.
- WidgetDisplayName
- The name that displays within the Commerce Composer tool in Management Center to help business users identify the widget. For example, Sample Shopping Cart Detail widget.
- WidgetUIObjectName
- The name that identifies the Management Center object and definition of the widget. For example, ShoppingCartDetailPageWidget. The value for this parameter cannot include spaces or special characters.
- WidgetVendor
- The name of the company or vendor that created the widget. For example, MyCompany. The value for this parameter cannot include spaces or special characters.
- WidgetType
- The type of the widget. The possible values for the property are:
- 1
- Widget
- 2
- Container
- WidgetPath
- The relative path to the entry point top-level JSP file for the widget. For example, /Widgets-MyCompany/com.mycompany.commerce.store.widgets.ShoppingCartDetail/ShoppingCartDetail.jsp
- WidgetDefinitionxml
- The XML definition for the dynamic properties of the widget. In the example for this tutorial, no additional properties are defined for the Shopping Cart widget so you do not need to specify a value for this column.
- WidgetState
- The state of the widget registration. The possible values for the property are:
- 1
- Active.
- 2
- Inactive.
- WidgetStoreUniqueID
- The unique reference number of the store in which you are registering the widget. You can use
the property to specify whether the widget is to be a site-level or store-level widget. The possible
values of the property are:
- storeId
- The store ID value that is defined within the STORE_ID column of the STORE database table. Specify an ID to register the widget within the specified store. The
widget is not shared with other stores unless the widget is also registered with another store.
Note: If you specify an asset store ID, the Data Load utility registers the widget with all extended site stores for that asset store. Each individual extended site store however must still subscribe to the widget separately before the widget can be used for the store.
- 0
- Specify a value of 0 to register the widget at the site-level. The registered widget can be shared across all stores in the site.
- WidgetDescription
- The description that displays for the widget within the Commerce Composer tool in Management Center to help business users identify the widget. For example, This widget is for Shopping Cart details.
- Delete
- A flag that indicates whether to delete the widget definition. Specify 1 to delete the widget. The default value is 0, which indicates that the Data Load utility is to load the information for the row into the database.
Your registerWidgetdef.csv input CSV file can resemble the following file. (Note that the image is split into two rows to fit on this page):Note: The registerWidgetdef.csv subscribes the store that has the identifier that is set within the data load environment configuration file to the widget. If you do not set a value within the environment configuration file, the store that you identify when you run the Data Load utility subscribes to the widget.For more information about completing your registerWidgetdef.csv input CSV file, see registerWidgetdef input file.
For more information about registering a widget and defining the widget definition XML for a widget, see Registering a Commerce Composer widget.
- Save and close the CSV file.
-
Open the subscribeWidgetdef.csv file for editing.
You use the subscribeWidgetdef.csv input file to subscribe additional stores to the widget. You can also use the CSV input file to override the definition xml of the widget for a store. The subscribeWidgetdef.csv input file loads data into the PLSTOREWIDGET database table. The generated subscribeWidgetdef.csv input file includes information that you included in the JET pattern input XML file. You can update the CSV file to include more information about your widget before you load the CSV fileEnsure that the following columns within the CSV file are correctly specified:
- WidgetDefIdentifier
- The external reference name for the widget definition. Ensure that the value for the property is the same as the value specified for the widget within the registerWidgetdef.csv file. For example, ShoppingCartDetailWidget. The value for this parameter cannot include spaces or special characters.
- WidgetDefinitionxml
- The XML definition for the dynamic properties of the widget. If you specify a value for the
property, you override the value for the
WidgetDefinitionxml
column in the registerWidgetdef.csv file for a store. For this tutorial, do not specify a value for the property. - WidgetState
- The state of the widget registration. The possible values for the property are:
- 1
- Active.
- 2
- Inactive.
- Delete
- A flag that indicates whether to delete the widget definition. Specify 1 to delete the widget. The default value is 0, which indicates that the Data Load utility is to load the information for the row into the database.
Your subscribeWidgetdef.csv input file can resemble the following file. (Note that the image is split into two rows to fit on this page):Note: You do not have to specify the identifier for your store. The Data Load utility uses the value for the store identifier that is set within the data load environment configuration file. If you do not set a value within the environment configuration file, you must enter an identifier when you run the Data Load utility.For more information about completing your subscribeWidgetdef.csv input file, see subscribeWidgetdef input file.
- Save and close the file.
-
Configure the Data Load utility so that you can use the utility to load your widget
information.
-
Run the Data Load utility.