Sample: Loading Commerce Composer widget descriptive information in multiple languages
This sample demonstrates how to load descriptive information for Commerce Composer in multiple languages for use in Management Center and on the storefront.
Before you begin
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:- 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
If you have Commerce Composer widgets for your store, you can use the Data Load utility to load descriptive information for the widgets in more languages. This sample loads the descriptive information for a widget in two languages, English (en_US), and French (fr_FR). For more information about the languages that are supported by default, see Supporting globalization.
Before you can load the descriptive information for a widget, the widget must be created, registered, and subscribed to a store. For more information about creating widgets, see Creating Commerce Composer widgets. For more information about loading information to register and subscribe widgets to a store, see Sample: Loading Commerce Composer widgets.
- utilities_root/samples/DataLoad/CommerceComposer/widget/MultiLanguages
- WCDE_installdir\samples\DataLoad\CommerceComposer\widget\MultiLanguages
- To load the information in a single file, load the
wc-dataload-widgetdefdesc-one-step-lang.xml data load order configuration file.
When you run this load order file, the Data Load utility loads the information within the
registerWidgetdefdescWithTwoLanguages.csv sample input file. The
registerWidgetdefdescWithTwoLanguages.csv contains multiple description and
display name columns. Both description columns are mapped to the same database column. Both display
name columns are also mapped to the same column. The business object configuration file however
configures the Data Load utility to create separate entries for the widget within the database, one
for each language. Note: The configuration that handles the loading of information in multiple languages for this option is defined within the business object configuration file.
- To load the multiple language information in separate files, load the
wc-dataload-widgetdefdesc-two-step-lang.xml. When you load this file, the Data
Load utility loads the information within the registerWidgetdefLanguageOne.csv
and registerWidgetdefdescLanguageTwo.csv sample input files. The
registerWidgetdefLanguageOne.csv file includes the information to register the
widget and default language (English) information. The
registerWidgetdefdescLanguageTwo.csv includes the information to load the
French language information for the widget.Note: When you use the separate file approach, the configuration that identifies the language that data is being loaded within is defined within the data load order configuration file.
If you are using this sample to help you load Commerce Composer widget information that exists in another instance, you can use the Data Extract utility to generate the input files for loading your widget data. You can use the Data Extract utility to extract the existing widget registration data. Then, you 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 widget data, see Sample: Extracting Commerce Composer widgets. Since the Data Extract utility sample files extract the widget descriptive information for all languages in a single file, use the single file approach to load the extracted data.
Sample input file | Description |
---|---|
CSV
For more information about the type of data within the input file, see registerWidgetdef input file |
The Data Load utility loads the information to register a widget for use in the Commerce Composer tool. The Data Load utility loads the descriptive information within the 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 this input file: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.RegisterWidgetDefMediator Business
object configuration file
|
CSV
For more information about the type of data within the input file, see registerWidgetdefdesc input file |
The Data Load utility loads the descriptive information of a widget in multiple languages. The Data Load utility loads the descriptive information within the 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 this input file: Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.RegisterWidgetDefMediator Business
object configuration file
|
CSV
|
This sample input file contains the information to register the widget and the
widget descriptive information within a single file. This sample file includes the contents of both
the registerWidgetdefLanguageOne.csv and
registerWidgetdefdescLanguageTwo.csv sample input files. Business object mediator com.ibm.commerce.pagelayout.dataload.mediator.RegisterWidgetDefMediator Business
object configuration file
|
Procedure
- On a command line, go to the WCDE_installdir\bin directory.
- Open a command line in the . Change the directory to utilities_root/bin directory. For information about entering and leaving containers, see Running utilities from the Utility server Docker container.
- Enter the following command to run the sample data load order file to load the widget
descriptive information in multiple languages:
- To load the descriptive information within a single sample input file:
- ./dataload.sh ../samples/DataLoad/CommerceComposer/widget/MultiLanguages/wc-dataload-widgetdefdesc-one-step-lang.xml
- dataload ..\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-one-step-lang.xml
- To load the descriptive information within separate sample input files:
- ./dataload.sh ../samples/DataLoad/CommerceComposer/widget/MultiLanguages/wc-dataload-widgetdefdesc-two-step-lang.xml
For more information about configuring and running the Data Load utility, see Configuring and running the Data Load utility.
- To load the descriptive information within a single sample input file:
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 view the French language description for the widget in the Commerce Composer tool. Log in to Management Center in the French language and create 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 appropriate language description for the widget shows in the Add Widgets to Slots window.
Removing the sample data from the HCL 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.