Sample: Loading Commerce Composer page SEO information in multiple languages

This sample demonstrates how to load SEO information for Commerce Composer pages in multiple languages for use in the Commerce Composer tool 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:

About this sample

By loading the information in this sample, you load SEO information in multiple languages for a sample Commerce Composer help page. Before you run this sample, ensure that create the sample Commerce Composer help page. To create the sample help page, run the Data Load utility sample for Loading Commerce Composer pages.

The SEO information for the sample help page is available in two languages. When you run this sample, you can choose to load the information for each language in a single input file or within two separate files. You can also 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:
  • Linuxutilities_root/samples/DataLoad/CommerceComposer/page/MultiLanguages
  • HCL Commerce DeveloperWCDE_installdir\samples\DataLoad\CommerceComposer\page\MultiLanguages

If you are using this sample to help you load Commerce Composer page information that exists in another instance, you can use the Data Extract utility to generate the input files for loading your page data. You can use the Data Extract utility to extract the existing page 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 page data, see Sample: Extracting Commerce Composer pages. Since the Data Extract utility sample files extract the page SEO descriptive information for all languages in a single file, use the single file approach to load the extracted 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
  • seopageDescWithTwoLanguages.csv
  • seopageDescLanguageOne.csv
  • seopageDescLanguageTwo.csv
XML
  • seopageDescWithTwoLanguages.xml
  • seopageDescLanguageOne.xml
  • seopageDescLanguageTwo.xml

For more information about the type of data within the input file, see seopage input file

The Data Load utility uses this sample input file to load custom search engine optimization (SEO) descriptive information in multiple languages for a content page.

You can use the seopageDescLanguageOne.csv and seopageDescLanguageTwo.csv files to load language specific SEO information for a page in separate files. If you want to load SEO information in multiple languages within a single file, you can load the seopageDescWithTwoLanguages.csv file.

The Data Load utility loads the SEO descriptive information in the input file into the SEOURL, SEOURLKEYWORD, SEOPAGEDEF, SEOPAGEDEFDESC, SEOPAGEDEFOVR, SEOREDIRECT 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.SeoPageDescMediator

Business object configuration file
  • Linuxutilities_root/samples/DataLoad/CommerceComposer/wc-loader-seopagedesc.xml
  • HCL Commerce DeveloperWCDE_installdir\samples\DataLoad\CommerceComposer\wc-loader-seopagedesc.xml
For more information about business object configuration files, see Configuring the business object configuration file.

Procedure

  1. HCL Commerce DeveloperOn a command line, go to the WCDE_installdir\bin directory.
  2. LinuxOpen 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.
  3. Enter the following command to run the sample data load order file for a Commerce Composer page and load the information for this sample:
    • To load the SEO descriptive information in multiple languages for a page in a single file, run the following command:
      • Linux./dataload.sh ../samples/DataLoad/CommerceComposer/page/MultiLanguages\wc-dataload-seopagedesc-one-step-lang.xml
      • HCL Commerce Developerdataload ..\samples\DataLoad\CommerceComposer\page\MultiLanguages\wc-dataload-seopagedesc-one-step-lang.xml
    • To load the SEO descriptive information in multiple languages for a page in separate files, run the following command:
      • Linux./dataload.sh ../samples/DataLoad/CommerceComposer/page/MultiLanguages/wc-dataload-seopagedesc-two-step-lang.xml
      • HCL Commerce Developerdataload ..\samples\DataLoad\CommerceComposer\page\MultiLanguages\wc-dataload-seopagedesc-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 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.

You can also verify that the sample data is loaded by running the following SQL statements against your HCL Commerce database:
select * from SEOPAGEDEF where PAGENAME in ('Content_' || (select CAST (CAST(plpage_id AS CHAR(50))
 AS VARCHAR(50)) 
 from plpage where adminname = 'SampleHomePage'), 'Content_' || (select CAST (CAST(plpage_id AS CHAR(50))
 AS VARCHAR(50)) 
 from PLPAGE where ADMINNAME = 'SampleHelpPage'));
select * from SEOPAGEDEFDESC where SEOPAGEDEF_ID in ( select SEOPAGEDEF_ID 
 from SEOPAGEDEF where PAGENAME in ('Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) AS VARCHAR(50)) 
 from plpage where adminname = 'SampleHomePage'), 'Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) 
 AS VARCHAR(50)) 
 from PLPAGE where ADMINNAME = 'SampleHelpPage')));
select * from SEOPAGEDEFOVR where SEOPAGEDEF_ID in ( select SEOPAGEDEF_ID 
 from SEOPAGEDEF where PAGENAME in ('Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) AS VARCHAR(50)) 
 from plpage where adminname = 'SampleHomePage'), 'Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50))
 AS VARCHAR(50)) 
 from PLPAGE where ADMINNAME = 'SampleHelpPage')));
select * from SEOREDIRECT;
select * from SEOURL where TOKENNAME='StaticPagesToken' and TOKENVALUE in ( select CAST(PLPAGE_ID AS CHAR(50)) 
 from PLPAGE where ADMINNAME like 'Sample%');
select * from SEOURLKEYWORD where SEOURL_ID in ( select SEOURL_ID 
 from SEOURL where TOKENNAME='StaticPagesToken' and TOKENVALUE in ( select CAST(PLPAGE_ID AS CHAR(50)) 
 from PLPAGE where ADMINNAME 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 SEO information in the Commerce Composer tool. Log in to Management Center in the French language and View the SEO properties for a content page. Select the page that you added the alternate language SEO description for, and ensure that the appropriate language description shows in the properties view for the page.

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.