Sample: Loading Commerce Composer layout templates

This sample demonstrates how to load Commerce Composer layout templates for use in creating layouts with the Commerce Composer tool.

Before beginning

This sample requires a published store that is based on the Aurora starter store and the Commerce Composer tool. Ensure that the following tasks are complete:


About this sample

A layout template is a reusable starting point that can be used when we are creating a layout. A layout template is a wireframe that includes a specific arrangement of slots. When a user creates a layout in the Commerce Composer tool, widgets are assigned to these slots. When you load the sample CSV input files for this sample, you create the following layout templates in the Commerce Composer tool

We can load the information for this sample in both CSV or XML formatted input files. The following procedure, however, loads only the CSV input files. If you prefer to work with the data within the XML formatted files, we can edit the sample configuration files to use the XML files. The sample input files are located within the following directory:

If we are using this sample to help us create Commerce Composer layout templates that exist in another instance, we can use the Data Extract utility to generate the input files for loading your template data. We can use the Data Extract utility to extract the existing template data. Then, we can edit configuration files for this sample to load the files that are generated by the Data Extract utility. For a sample that demonstrates how to use the Data Extract utility to extract template data, see Sample: Extracting Commerce Composer layout templates.

Input source files for loading Commerce Composer layout templates. This table also lists the business object mediators used by the Data Load utility to load the template data.
Sample input file Description
CSV

  • registerWidgetdef.csv

XML

  • registerWidgetdef.xml

For more information about the data included in this file, see registerWidgetdef input file

The Data Load utility uses this input file to register a template container for use in creating the template.

The Data Load utility loads the information within the input file 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 this input file:

Business object mediator

com.ibm.commerce.pagelayout.dataload.mediator.registerWidgetdefMediator Sample business object configuration file for loading this information:

  • (Linux) utilities_root/samples/DataLoad/CommerceComposer/wc-loader-registerWidgetdef.xml

  • (Developer) WCDE_installdir\samples\DataLoad\CommerceComposer\wc-loader-registerWidgetdef.xml

CSV

  • slotDefinition.csv

XML

  • slotDefinition.xml

For more information about the data included in this file, see slotDefinition input file

This sample input file loads information to define the slots within a container for a template. Each slot is defined with x and y coordinates.

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

  • (Linux) utilities_root/samples/DataLoad/CommerceComposer/wc-loader-widgetslot.xml

  • (Developer) WCDE_installdir\samples\DataLoad\CommerceComposer\wc-loader-widgetslot.xml

CSV

  • subscribeWidgetdef.csv

XML

  • subscribeWidgetdef.xml

For more information about the data included in this file, see subscribeWidgetdef input file

This sample input file loads information to subscribe a template container to a store.

The Data Load utility loads the information within the input file 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

  • (Linux) utilities_root/samples/DataLoad/CommerceComposer/wc-loader-subscribeWidgetdef.xml

  • (Developer) WCDE_installdir\samples\DataLoad\CommerceComposer\wc-loader-subscribeWidgetdef.xml

CSV

  • template.csv

XML

  • template.xml

For more information about the data included in this file, see template input file

This sample input file loads information that defines the 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

  • (Linux) utilities_root/samples/DataLoad/CommerceComposer/wc-loader-template.xml

  • (Developer) WCDE_installdir\samples\DataLoad\CommerceComposer\wc-loader-template.xml


Procedure

  1. (Developer) On a command line, go to the WCDE_installdir\bin directory.

  2. (Linux) Open a command line in the Utility server Docker container. Change the directory to utilities_root/bin directory.
    For information about entering and leaving containers, see Running utilities from the Utility server Docker container.

  3. Enter the following command to run the sample data load order file for a Commerce Composer layout template and load the information for this sample:

    • (Linux) ./dataload.sh ../samples/DataLoad/CommerceComposer/template/wc-dataload-template.xml

    • (Developer) dataload ..\samples\DataLoad\CommerceComposer\template\wc-dataload-template.xml

    The load order configuration file identifies the order that the Data Load utility loads the sample CSV files. The load order file also identifies the appropriate business object configuration file to use to load each input file. For more information about load order configuration files,
    Configure the data load order.

    For more information about configuring and running the Data Load utility, see Configure and running the Data Load utility.


Verifying results

Verify that the Commerce Composer tool page 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. We can also verify that the sample data is loaded by running the following SQL statements against the WebSphere Commerce database:

Ensure that the data within the sample input files exists within the appropriate database tables.

In Management Center, verify that users can use the layout template in the Commerce Composer tool by Creating a layout for a page. When we are creating the layout, select a template to use for our layout. Ensure that the templates you loaded are in the New Layout Template Selection window. The following image shows the new layout templates within the New Layout Template Selection window.


Removing the sample data from the WebSphere Commerce database

To remove the sample data from the 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 the database. Alternatively, we can run the Cleanup.sql file for this data load sample. The Cleanup.sql file is located within the following directory:

From a command prompt, connect to the database with your user ID and password. Run the following command: (DB2)

(Oracle)