
Sample: Loading Commerce Composer widgets
This sample demonstrates how to load Commerce Composer widget information to register a widget and subscribe a store to a widget. After you register and subscribe a widget with the Data Load utility, Management Center users can use the widget to design store pages with the Commerce Composer tool.
Before you begin
This sample requires a published store that is based on the Aurora starter store that is provided with WebSphere Commerce Feature Pack 7 and the Commerce Composer tool. Ensure that the following tasks are complete:- Review the Commerce Composer data load best practices. Follow these best practices when you load Commerce Composer assets with the Data Load utility.
About this sample
When you are creating a Commerce Composer widget, in addition to the storefront assets that you must create, you must use the Data Load utility to load and register the definition information for the widget. You must also load the relationship between the widget and a store to subscribe the store to use the widget. A store must subscribe to a widget for that widget to be available for users to include on a page for that store. The following sample loads the information that is needed to register a widget and have a store subscribe to the widget. When you load this information, you create two widgets, a Sample site widget and a Sample store widget. This sample, however, does not create the storefront or Management Center definition for the widget. For more information about creating a widget, see Creating Commerce Composer widgets.
WC_installdir/components/foundation/samples/DataLoad/CommerceComposer/widget
WC_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget
WCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget
WC_installdir/components/foundation/samples/DataLoad/CommerceComposer/template
WC_installdir\components\foundation\samples\DataLoad\CommerceComposer\template
WCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\template

Sample input file | Description |
---|---|
CSV
XML
For more information about the data that is included in this file, see registerWidgetdef input file |
The Data Load utility uses this sample input file to load information that
registers layout template containers and widgets within the WebSphere Commerce database and Commerce Composer framework. This sample loads two
registerWidgetdef.csv input files:
The order that the Data Load utility loads the information within these input files is defined within the wc-dataload-widget.xml load order configuration file. The registerWidgetdef.csv file within the template loads before the file within the widget directory. The Data Load utility loads the information within these input files into the PLWIDGETDEF, and PLWIDGETDEFDESC database tables. The Data Load utility uses the following business object mediator and business object configuration file to load the data within these input files: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.registerWidgetdefMediator Sample
business object configuration file for loading this information:
|
CSV
XML
For more information about the data that can be included in this file, see subscribeWidgetdef input file |
After the Data Load utility loads the information to register the widgets and containers, the utility loads two subscribeWidgetdef.csv files to subscribe the widgets and containers to a store. A store must subscribe to specific widgets and containers so that these objects can be used in the Commerce Composer tool for that store. This sample loads two subscribeWidgetdef.csv files:
The Data Load utility loads the information within these input files into the PLSTOREWIDGET database table. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.SubscribeWidgetDefinitionMediator Business object configuration file
|
CSV
XML
For more information about the data that is included in this file, see template input file |
This input file loads information to create the relationship between template
containers and a template. This file is also loaded as part of the sample for loading a Commerce Composer layout template. The Data Load utility loads the information within the input file into the PAGELAYOUT database table. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.WidgetMediator Business
object configuration file
|
CSV
XML
For more information about the data that is included in this file, see slotDefinition input file |
This input file loads information to define the slots within a container for a
template. Each slot is defined with x and y coordinates. Management Center uses this information to
draw the wireframe for the template within the Commerce Composer tool. The Data Load utility loads the information within the input file into the PLWIDGETSLOT database table. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.WidgetSlotsMediator Business
object configuration file
|
CSV
XML
For more information about the data that is included in this file, see layout input file |
The Data Load utility loads this input file to load layout information into a
store so that Management Center users can use the layouts in the Commerce Composer tool. The Data Load utility loads the information within the input file into the PAGELAYOUT, and PLTEMPLATEREL database tables. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.LayoutMediator Business
object configuration file
|
CSV
XML
For more information about the data that is included in this file, see layoutWidgetRelationship input file |
This input file loads information about the relationship between widgets,
containers, and a layout. This file loads the information to associate a container and widget with a
layout template to create a layout. The Data Load utility loads the information within the input file into the PLWIDGET, and PLWIDGETREL database tables. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.WidgetMediator Business
object configuration file
|
This sample loads widget information for a single language. For more information about loading widget descriptive information in multiple languages, see Sample: Loading Commerce Composer widget descriptive information in multiple languages.
Procedure
- Open a command-line utility and go to the appropriate directory:
WC_installdir/bin
WC_installdir\bin
WCDE_installdir\bin
- Enter the following command to run the sample data load order
file for a Commerce Composer widget
and load the information for this sample:
./dataload.sh ../components/foundation/samples/DataLoad/CommerceComposer/widget/wc-dataload-widget.xml
dataload.bat ..\components\foundation\samples\DataLoad\CommerceComposer\widget\wc-dataload-widget.xml
dataload ..\components\foundation\samples\DataLoad\CommerceComposer\widget\wc-dataload-widget.xml
For more information about configuring and running the Data Load utility, see Configuring and running the Data Load utility.
Verifying results
Verify that the Commerce Composer tool widget information is loaded by reviewing the data load summary report. For more information about the location and contents of this summary report, see Verifying the results of the data load.
select * from PLWIDGETDEF where IDENTIFIER like 'Sample%';
select * from PLWIDGETDEFDESC where PLWIDGETDEF_ID in (select PLWIDGETDEF_ID from PLWIDGETDEF where
IDENTIFIER like 'Sample%');
select * from PLSTOREWIDGET where PLWIDGETDEF_ID in (select PLWIDGETDEF_ID from PLWIDGETDEF where
IDENTIFIER like 'Sample%');
Ensure
that the data within the sample input files exists within the appropriate database tables.In Management Center, verify that users can
use the widget in the Commerce Composer tool by Creating
a layout for a page. When you are creating the layout, select
a template slot to add a widget to the slot. Ensure that the widgets
you loaded are in the Add Widgets to Slots window.
The following image shows the Sample site widget and
the Sample store widget within the Add
Widgets to Slots window.
Removing the sample data from the WebSphere Commerce database
To remove the sample data from
your database, run the sample again but with the value for the delete
column for all entries within the files set to 1
.
By setting the value for this column to 1
, the Data
Load utility deletes the data that is identified in the CSV file from
your database.
WC_installdir/components/foundation/samples/DataLoad/CommerceComposer/widget
WC_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget
WCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget

- ij -f ..\components\foundation\samples\DataLoad\CommerceComposer\widget\Cleanup.sql

db2 -tvf ../components/foundation/samples/DataLoad/CommerceComposer/widget/Cleanup.sql
db2 -tvf ..\components\foundation\samples\DataLoad\CommerceComposer\widget\Cleanup.sql

sqlplus user_name/password@ database_name@ ../components/foundation/samples/DataLoad/CommerceComposer/widget/Cleanup.sql
sqlplus user_name/password@ database_name@ ..\components\foundation\samples\DataLoad\CommerceComposer\widget\Cleanup.sql