Sample: Loading sales catalogs

This sample demonstrates how to load catalog data with the Data Load utility. The sample demonstrates how to load a sales catalog, how to load sales categories and how to load catalog entries to a sales category.

About this sample

This sample loads a sales catalog called "Spring Fashions". The sample also creates the following sales categories and loads products into the categories:
  • Men's Fashions
  • Women's Fashions
  • Shirts
  • Activewear

Procedure for loading new sales catalog

Ensure that the catalog data you load in the sample CSV file contains data related to one sales catalog. To specify the sales catalog, you must define the catalog in the wc-dataload-env-sales-catalog.XML file, before you load your sample CSV file.

Note: When you load a sales catalog with the Data Load utility, linking is not supported. You cannot link a master category to a sales category with the Data Load utility. To create these links, you must use Management Center.
  1. Before running the Data Load sample, ensure that you update the wc-dataload-env-sales-catalog.xml configuration file with the correct environment and store settings.
    1. Open the wc-dataload-env-sales-catalog.xml in the appropriate directory:
      • Linuxutilities_root/samples/DataLoad/Catalog/SalesCatalogAndGroups/wc-dataload-env-sales-catalog.xml.
      • HCL Commerce DeveloperWCDE_installdir\samples\DataLoad\CatalogSalesCatalogAndGroups\wc-dataload-env-sales-catalog.xml.
    2. Update the file to include the correct environment and store settings:
      <_config:BusinessContext storeIdentifier="MadisonsESite" catalogIdentifier="Spring Fashions"
      languageId="-1" currency="USD">
        <_config:ContextData name="fulfillmentCenterName">Madisons Home</_config:ContextData>
      </_config:BusinessContext>

      The storeIdentifier is the identifier of the store which you want to create the sales catalog for. The catalogIdentifier is the identifier of the sales catalog that you are loading called "Spring Fashions".

  2. HCL Commerce DeveloperOn a command line, go to the WCDE_installdir\bin directory.
  3. 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.
  4. Enter the following command to load your sample CSV file. The wc-dataload.xml configuration file calls the wc-loader-catalog.xml configuration file (in the parent directory) to load the catalog data from the Catalog.csv source file:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/SalesCatalogAndGroups/wc-dataload.xml
    • HCL Commerce Developerdataload ..\samples\DataLoad\Catalog\SalesCatalogAndGroups\wc-dataload.xml
  5. Run the following SQL command to verify that a sales catalog is created with the code 'Spring Fashions':
    select * from catalog where identifier in ('Spring Fashions')
    This SQL command returns the sales catalog 'Spring Fashions'.

Procedure for loading new sales categories

  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 load your sample CSV file. The wc-dataload-sales-catalog-groups.xml configuration file calls the wc-loader-catalog-catalog-group.xml configuration file (in the parent directory) to load the catalog data from the CatalogGroup.csv source file:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/SalesCatalogAndGroups/wc-dataload-sales-catalog-groups.xml
    • HCL Commerce Developerdataload ..\samples\DataLoad\Catalog\SalesCatalogAndGroups\wc-dataload-sales-catalog-groups.xml

Procedure for adding products to sales categories

  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 load your sample CSV file. The wc-dataload-catalog-entry-parent-catalog-groups.xml configuration file calls the wc-loader-catalog-entry-parent-catalog-group.xml configuration file (in the parent directory) to load the catalog data from the SaleCatalogGroupCatalogEntries.csv source file:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/SalesCatalogAndGroups/wc-dataload-catalog-entry-parent-catalog-groups.xml
    • HCL Commerce Developerdataload ..\samples\DataLoad\Catalog\SalesCatalogAndGroups\wc-dataload-catalog-entry-parent-catalog-groups.xml
Note: If you add a catalog entry that has child SKUs to a sales category, you must add the child SKUs to the sales category. If you add a catalog entry to a sales category without adding its child SKUs, searching for, or displaying the SKUs does not function properly. To add child SKUs to a sales category, follow the same steps as adding catalog entries to sales categories.
Note: If you remove a catalog entry that has child SKUS from a sales category, you must remove the child SKUs from the sales category. If you remove a catalog entry from a sales category without removing its child SKUs, searching for, or displaying the SKUs does not function properly. To remove child SKUs from a sales category, follow the same steps as removing catalog entries from the sales categories. To remove catalog entries from a catalog, follow the same steps as adding catalog entries, but mark the catalog entries for deletion within the CSV file.

Verifying results

To verify that the sales catalog is loaded correctly, run the following SQL command:
select * from catgroup where catgroup_id in (select catgroup_id from cattogrp where catalog_id in 
(select catalog_id from catalog where identifier in ('Spring Fashions'))) or catgroup_id in (select catgroup_id_child from 
catgrprel where catalog_id in (select catalog_id from catalog where identifier in ('Spring Fashions')))
This SQL command returns the categories loaded in the sales catalog 'Spring Fashions'.
To verify that the catalog entries are added to sales categories correctly, run the following SQL command:
select * from catgpenrel where catgroup_id in (select catgroup_id from cattogrp where catalog_id in 
(select catalog_id from catalog where identifier in ('Spring Fashions'))) or catgroup_id in (select catgroup_id_child from catgrprel 
where catalog_id in (select catalog_id from catalog where identifier in ('Spring Fashions')))
This SQL command returns the relationship between the sales categories and the catalog entries under the sales categories.
You can also verify the results by viewing the sales catalog in the Management Center Catalogs tool or in the storefront. To view the sales catalog in the storefront, update the URL with the catalog ID of the sales catalog. For example, if your store ID is 12345 and the catalog ID of your sales catalog is 100000001234, enter the following URL:
http://your_host_name.com/webapp/wcs/stores/servlet/TopCategoriesDisplay?langId=
-1&storeId=12345&catalogId=100000001234
Where your_host_name.com is the host name of your server.

Cleaning up the data

If you want to use another sample, first remove the data loaded in this sample. To remove the data loaded in this sample, run the CleanUp.sql file in the /samples/DataLoad/Catalog/SalesCatalogAndGroups directory.