Sample: Loading list prices in multiple currencies

This sample demonstrates how to load list prices in multiple national currencies simultaneously. You can load different national currencies to your store by modifying the source file in the sample. All currency codes are based on the ISO 4217 standard.

About this sample

The following currencies are loaded in this sample:
  • United States dollar (USD)
  • Canadian dollar (CAD)
  • Euro (EUR)

Procedure

  1. Edit the wc-loader-catalog-entry.xml file to update the Data Load settings.
    1. Navigate to the sample directory.

      LinuxOpen a command-line shell in the Utility Docker container. For information about entering and leaving containers, see Running utilities from the Utility server Docker container. Change the directory to:

      utilities_root/samples/DataLoad/Catalog/MultiListPrices

      HCL Commerce DeveloperGo to the directory:WCDE_installdir\samples\DataLoad\Catalog\MultiListPrices

    2. Open the wc-loader-catalog-entry.xml for editing.
    3. Create a BusinessObjectBuilder mediator in the file as a child element of the <_config:DataLoader> mediator.
    4. Add the following code to the created BusinessObjectBuilder mediator:
      <_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.
        BaseBusinessObjectBuilder"
                 packageName="com.ibm.commerce.price.facade.datatypes.PricePackage" dataObjectType="PriceListType" >
        <_config:DataMapping>
          <!-- The unique reference number of the catalog entry -->
          <_config:mapping xpath="PriceEntry[0]/CatalogEntryIdentifier/UniqueID" value="CatalogEntryUniqueId" />
          <!-- The part number of the catalog entry -->
          <_config:mapping xpath="PriceEntry[0]/CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" />
          <!-- The Offer price -->
          <_config:mapping xpath="PriceEntry[0]/Price/Price/value" value="ListPrice" />
          <!-- The Offer price currency -->
          <_config:mapping xpath="PriceEntry[0]/Price/Price/currency" value="CurrencyCode" />
          <!-- When more than one Offer is effective at a particular time, the one with the highest Precedence is used -->
          <_config:mapping xpath="PriceEntry[0]/precedence" value="Precedence" />
          <!-- The Offer start date -->
          <_config:mapping xpath="PriceEntry[0]/startDate" value="StartDate" />
          <!-- The Offer end date -->
          <_config:mapping xpath="PriceEntry[0]/endDate" value="EndDate" />
          <!-- The unit of measure for MinimumQuantity and MaximumQuantity -->
          <_config:mapping xpath="PriceEntry[0]/quantityUnit" value="QuantityUnit" />
          <!-- The minimum quantity that can be purchased in a single Order under this Offer -->
          <_config:mapping xpath="PriceEntry[0]/minimumQuantity" value="MinimumQuantity" />
          <!-- The maximum quantity that can be purchased in a single Order under this Offer -->
          <_config:mapping xpath="PriceEntry[0]/maximumQuantity" value="MaximumQuantity" />
          <!-- The Offer description -->
          <_config:mapping xpath="PriceEntry[0]/Description/value" value="Description" />
          <!-- The Offer description language -->
          <_config:mapping xpath="PriceEntry[0]/Description/language" value="Language" />
          <_config:mapping xpath="PriceEntry[0]/Description/language" value="LanguageId" />
          <_config:mapping xpath="PriceEntry[0]/Price/AlternativeCurrencyPrice[0]/currency" 
            value="AlternativeCurrency1" />
          <_config:mapping xpath="PriceEntry[0]/Price/AlternativeCurrencyPrice[0]/value" 
            value="AlternativeListPrice1" />
          <_config:mapping xpath="PriceEntry[0]/Price/AlternativeCurrencyPrice[1]/currency" 
            value="AlternativeCurrency2" />
          <_config:mapping xpath="PriceEntry[0]/Price/AlternativeCurrencyPrice[1]/value" 
            value="AlternativeListPrice2" />
          
          <!-- The Delete indicator -->
          <_config:mapping xpath="" value="Delete" deleteValue="1" />
        </_config:DataMapping>
      <_config:BusinessObjectMediator className="com.ibm.commerce.price.dataload.mediator.ListPriceOfferMediator" 
        componentId="com.ibm.commerce.price" >
      </_config:BusinessObjectMediator>
      </_config:BusinessObjectBuilder>
  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:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/MultiListPrices/wc-dataload.xml
    • HCL Commerce Developerdataload ..\samples\DataLoad\Catalog\MultiListPrices\wc-dataload.xml

Verifying results

The wc-dataload.xml configuration file calls the wc-loader-catalog-entry.xml configuration file to load product, SKU, and list price information from the CatalogEntries.csv source file, which is located within the same directory. Three list prices are created for each catalog entry. The default currency is USD. The alternate currencies are loaded from the AlternativeCurrency1 and AlternativeCurrency2 columns in the CSV file. The alternate list price values are loaded from the AlternativeListPrice1 and AlternativeListPrice2 columns in the CSV file.
Verify that the data is loaded by running the following SQL statements:
  • To return the multiple list prices that are created for the product and SKU, enter:
    select * from listprice where catentry_id in (select catentry_id from catentry where 
    partnumber like 'Cords%')

You can also verify the load by viewing the currencies in the Management Center or in the storefront.

Cleaning up the data

To remove the data that is loaded in this sample from the database, run the CleanUp.sql file in the /samples/DataLoad/Catalog/MultiListPrices directory.