Feature Pack 8

Building the WebSphere Commerce search contract price index

You can build the WebSphere Commerce search contract price index by using the calculate price utility when you deploy a starter store. The utility updates the information in the price index based on the pricing model your store uses. For example, for a B2B starter store, the price index is built to display contract prices in the storefront.

Before you begin

  • WebSphere Commerce DeveloperEnsure that the test server is started in Rational Application Developer.
  • SolarisLinuxAIXWindowsEnsure that your administrative server is started. For example:
    • If WebSphere Commerce is managed by WebSphere Application Server Deployment Manager (dmgr), start the deployment manager and all node agents. Your cluster can also be started.
    • If WebSphere Commerce is not managed by WebSphere Application Server Deployment Manager (dmgr), start the WebSphere Application Server server1.

Procedure

  1. Complete one of the following tasks:
    • SolarisLinuxAIXLog on as a WebSphere Commerce non-root user.
    • For IBM i OS operating systemLog on with a user profile that has *SECOFR authority.
    • WindowsLog on with a user ID that is a member of the Windows Administration group.
  2. Go to the following directory:
    • SolarisLinuxAIXWindowsWC_installdir/components/foundation/samples/dataimport/catalog/dbtype
    • WebSphere Commerce DeveloperWCDE_installdir/components/foundation/samples/dataimport/catalog/dbtype
  3. Work with the following files to ensure that you are using the correct price mode for your starter store. Choose one of the following three options based on your current configuration and planned expansions.

    If you plan to deploy only B2C starter stores, the following pricing files are used by default, with no changes needed:

    • wc-dataimport-preprocess-offerprice.xml
    • wc-dataimport-preprocess-cntrprice.xml.contractedprice
    If you plan to deploy only B2B starter stores:
    • Rename wc-dataimport-preprocess-offerprice.xml to wc-dataimport-preprocess-offerprice.xml.compatible
    • Rename wc-dataimport-preprocess-cntrprice.xml.contractedprice to wc-dataimport-preprocess-cntrprice.xml
    If you plan to deploy both a B2C and B2B starter stores:
    • Rename wc-dataimport-preprocess-cntrprice.xml.contractedprice and rename the copy to wc-dataimport-preprocess-cntrprice.xml
  4. Set up the WebSphere Commerce search index.
  5. Change the price mode to wc.search.priceMode.compatiblePriceIndex in the STORECONF table:
    
    insert into storeconf(storeent_id,name,value) values('storeent_id', 'wc.search.priceMode.compatiblePriceIndex', '1.0');
    
    For more information, see Changing search configuration properties in the STORECONF table.
  6. Preprocess the WebSphere Commerce search index.
  7. If you are using sharding:
    1. Open the following file for all shards: WC_installdir/instances/instance_name/search/solr/home/MC_masterCatalogId/Shards/locale/CatalogEntry_#Shard-Tag#/conf/wc-data-config.xml.
    2. Find all instances of the following table name TI_CNTRPRICE_0_#Shard-Tag#.
      Note: Replace 0 with the index scope of the master catalog you are working with in the SRCHCONF table.
    3. Replace them with the following table name: TI_CNTRPRICE_0.

      This update enables the utilities to look for contract prices in the TI_CNTRPRICE_0 table, instead of the shard-specific tables.

    4. Save your changes.
  8. Go to the following directory:
    • WC_installdir/bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  9. If you are using price rules with catalog filters, you must build the WebSphere Commerce search index prior to calculating prices. This first of two index builds ensures that the correct product set is fetched for the calculation.
  10. Run the calculate price utility:
    • Windowsdi-calculateprice.bat -instance instance_name -serverName host_name -masterCatalogId masterCatalogId -siteAdminId siteAdminId [-siteAdminPwd siteAdminPwd] [-passwordFile passwordFile] [-trading trading] [-currency currency] [-catentry catentry] [-numWorkers numWorkers] [-flushSize flushSize]
    • For IBM i OS operating systemSolarisLinuxAIXdi-calculateprice.sh -instance instance_name -serverName serverName -masterCatalogId masterCatalogId -siteAdminId siteAdminId [-siteAdminPwd siteAdminPwd] [-passwordFile passwordFile] [-trading trading] [-currency currency] [-catentry catentry] [-numWorkers numWorkers] [-flushSize flushSize]
    • WebSphere Commerce Developerdi-calculateprice.bat -serverName serverName -masterCatalogId masterCatalogId -siteAdminId siteAdminId [-siteAdminPwd siteAdminPwd] [-passwordFile passwordFile] [-trading trading] [-currency currency] [-catentry catentry] [-numWorkers numWorkers] [-flushSize flushSize]
    Where:
    instance_name
    The name of the WebSphere Commerce instance with which you are working (for example, demo).
    host_name
    The fully qualified host name of your WebSphere Commerce Server (for example, wcserver.mydomain.ibm.com is fully qualified).
    masterCatalogId
    Required: The ID of the master catalog (for example, 10101).
    If you do not know the master catalog ID, run the following SQL:
    SQL: select * from catalog where IDENTIFIER='STORE_IDENTIFIER'
    
    To find the master catalog ID for an Extended Site store:
    1. Find the store ID:
      select * from storeent where IDENTIFIER='STORE_IDENTIFIER'
      
    2. Use the storeent_id as the store_id in the following SQL to find the catalog asset store ID of this Extended Site store:
      
      select * from storerel where store_id=XXXXXX and streltyp_id=-4 and relatedstore_id not in (XXXXXX)
      
      Where XXXXXX is the storeent_id from the SQL in step 10.a when building the search index.
    3. Get the master catalog ID:
      
      select * from storecat where storeent_id=YYYYYY and mastercatalog='1'
      
      Where YYYYYY is the relatedstore_id from step 10.b when building the search index.
    siteAdminId
    The user ID of the site administrator. The utility is run under the authority of this user.
    siteAdminPwd
    Optional: The password of the site administrator. You are prompted for the password if not passed in.
    Alternatively, you can use the passwordFile parameter to specify the encrypted password from a file.
    passwordFile
    Optional: The full path to the password.properties file that contains the site administrator password. For example, C:\password.properties.
    The password.properties file contains the following content:
    
    siteAdminPassword=encrypted_pwd
    
    Where encrypted_pwd is the site administrator password that is encrypted by the wcs_encrypt utility.
    trading
    Optional: Used to build prices for the specified contract IDs.
    Specify comma-separated contract IDs to index.
    If no contract IDs are passed in, a full recalculation is performed by default.
    currency
    Optional: Used to build prices for the specified currencies.
    Specify comma-separated currencies to index.
    Note: Ensure that the CURLIST table contains any additional currencies that you want built by the calculate price utility.
    If no currencies are passed in, a full recalculation is performed by default.
    catentry
    Optional: Used to build prices for the specified catalog entries.
    Specify comma-separated catalog entry IDs to index. Note: if you are using a version of WebSphere Commerce that has not had APAR JR54886 applied to it, enclose the comma-separated list in a pair of square brackets (for example, -catentry [catID1,catID2,...]).
    If no catalog entry IDs are passed in, a full recalculation is performed by default.
    numWorkers
    Optional: This parameter defines the number of calculators. The total number of products that are assigned to one calculator is arrived by dividing the number of products by the number of calculators. In every calculator, the assigned catentries are calculated against all valid buyer contracts that are deployed by the sharing stores of the specified master catalog and all valid currencies that are supported by the sharing stores. For large catalog size, it is recommended to define larger numWorkers to decrease the total execution time of a thread. In addition, the running thread is defined by workManager maximum number, therefore when the numWorkers are larger than work manager number, other numWorkers must wait in queue to be run.
    The default value is 1000.
    flushSize
    Optional: This parameter defines the number of batch statements that flush into database. With large flushSize, the database might roll back. With small flushSize, the database might have to be committed multiple times.
    The default value is 1000.
  11. Ensure that the utility runs successfully.
    If the utility runs successfully, the following message is displayed in the Command window:
    The calculate price utility completed successfully.
    Also, inspect the following file for errors:
    • SolarisLinuxAIXWindowsWC_installdir/logs/wc-dataimport-calculateprice.log
    • WebSphere Commerce DeveloperWCDE_installdir\logs\wc-dataimport-calculateprice.log
    If there are errors in the wc-dataimport-calculateprice.log, you can find more information from WC_profiledir/logs/solrServer/SystemOut.log
    To get more logging information, update the logging level from INFO to FINEST in the WC_installdir/instances/instance_name/xml/config/dataimport/calculateprice-logging.properties file:
    # Default global logging level, INFO
    com.ibm.commerce.level=FINEST
    
    You can also increase the log file size and the number of log files. For example:
    
    # Limiting size of output file in bytes:
    java.util.logging.FileHandler.limit=50000000
    
    # Number of output files to cycle through
    java.util.logging.FileHandler.count=2 
    
    If the utility fails due to a transaction timeout error, increase the transaction timeout time to a higher value. For more information, see Troubleshooting: Transaction timeout error from running the calculate price utility.
  12. If you are using sharding:
    1. Run the di-parallel-process utility. For specific usage, see Creating and indexing shards.
  13. Build the WebSphere Commerce search index.

Example

You can verify that the contract price index is used correctly in the Aurora B2B starter store by following these steps:
  1. Set up the organization and contract price index:
    1. Register an organization in the AuroraB2BESite.
    2. Set up the following contracts:
      Default contract copy
      Use the default catalog filter and offer price rule.
      Bolts Only Contract
      Include only the Bolts category only at 50% off.
    3. Switch to the contract price mode for the search index by renaming wc-dataimport-preprocess-offerprice.xml to wc-dataimport-preprocess-offerprice.xml.compatible and wc-dataimport-preprocess-cntrprice.xml.contractedprice to wc-dataimport-preprocess-cntrprice.xml.
    4. Change the price mode to wc.search.priceMode.compatiblePriceIndex in the STORECONF table.
    5. Preprocess the search index (di-preprocess utility).
    6. Log on to the Administration Console.
    7. Build the search index (di-buildindex utility) to ensure that the updated product set is correctly fetched in the next step.
    8. Build the contract price index (di-calculateprice utility). Optionally specify trading, currency, or catentry to build the respective price indexes.
    9. Build the search index again (di-buildindex utility).
  2. Verify the contract prices in the storefront:
    1. Open the AuroraB2BESite in a web browser and sign in to the store.
    2. Under contracts, select the Bolts Only contract and continue shopping.
    3. Go to the Bolts category and add items to your cart.
    4. Check out and confirm that the price rules are correctly applied during the checkout process.

What to do next

After the price index builds, you can optionally replicate and propagate the WebSphere Commerce search index.