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 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
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.
- WC_installdir/components/foundation/samples/DataLoad/CommerceComposer/widget/MultiLanguages
- WC_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages
- WCDE_installdir\components\foundation\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.
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
- 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 to load the widget descriptive information in multiple languages:
- To load the descriptive information within a single sample input
file:
- ./dataload.sh ../components/foundation/samples/DataLoad/CommerceComposer/widget/MultiLanguages/wc-dataload-widgetdefdesc-one-step-lang.xml
- dataload.bat ..\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-one-step-lang.xml
- dataload ..\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-one-step-lang.xml
- To load the descriptive information within separate sample input
files:
- ./dataload.sh ../components/foundation/samples/DataLoad/CommerceComposer/widget/MultiLanguages/wc-dataload-widgetdefdesc-two-step-lang.xml
- dataload.bat ..\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-two-step-lang.xml
- dataload ..\components\foundation\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 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.