Feature Pack 7 or later

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:If your store is not based on the Aurora starter store that is provided with WebSphere Commerce Feature Pack 7 or later, enable your store to use the Commerce Composer tool. For more information, see Task flow: Enabling Commerce Composer support for a starter store.

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.

You can load this sample information 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, you can edit the sample configuration files to use the XML files. The sample input files are located within the following directory:
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/widget/MultiLanguages
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages
To load this sample, you can load the multiple language information is separate files or within a single file.
  • 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.
Feature Pack 8If 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.
Note: You must apply the interim fixes for APAR JR53438.fep and APAR JR53438.fp to add support to the Data Extract utility for extracting Commerce Composer data.
The following table lists the sample input files that are use to load the data in this sample. The table also identifies the business object mediators and business object configuration files that the Data Load utility uses to load the sample data.
Sample input file Description
CSV
  • registerWidgetdefLanguageOne.csv
XML
  • registerWidgetdefLanguageOne.xml

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
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/wc-loader-registerWidgetdef.xml
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-registerWidgetdef.xml
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-registerWidgetdef.xml
CSV
  • registerWidgetdefdescLanguageTwo.csv
XML
  • registerWidgetdefdescLanguageTwo.xml

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
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/wc-loader-registerWidgetdefdesc.xml
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-registerWidgetdefdesc.xml
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-registerWidgetdefdesc.xml
CSV
  • registerWidgetdefdescWithTwoLanguages.csv
XML
  • registerWidgetdefdescWithTwoLanguages.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
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/widget/MultiLanguages/wc-loader-registerWidgetdefdesc-two-langs.xml
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-loader-registerWidgetdefdesc-two-langs.xml
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-loader-registerWidgetdefdesc-two-langs.xml

Procedure

  1. Open a command-line utility and go to the appropriate directory:
    • SolarisLinuxAIXWC_installdir/bin
    • WindowsWC_installdir\bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  2. 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:
      • SolarisLinuxAIX./dataload.sh ../components/foundation/samples/DataLoad/CommerceComposer/widget/MultiLanguages/wc-dataload-widgetdefdesc-one-step-lang.xml
      • Windowsdataload.bat ..\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-one-step-lang.xml
      • WebSphere Commerce Developerdataload ..\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-one-step-lang.xml
    • To load the descriptive information within separate sample input files:
      • SolarisLinuxAIX./dataload.sh ../components/foundation/samples/DataLoad/CommerceComposer/widget/MultiLanguages/wc-dataload-widgetdefdesc-two-step-lang.xml
      • Windowsdataload.bat ..\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-two-step-lang.xml
      • WebSphere Commerce Developerdataload ..\components\foundation\samples\DataLoad\CommerceComposer\widget\MultiLanguages\wc-dataload-widgetdefdesc-two-step-lang.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, Configuring the data load order.

    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.

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