Feature Pack 8

Indexing contract prices in WebSphere Commerce search

You can index prices in WebSphere Commerce search. For example, you can build the WebSphere Commerce search price index by using the calculate price utility, and then index contract prices.

Prices in WebSphere Commerce search

Prices that are returned by WebSphere Commerce search are either indexed or calculated:
  • Introduced in Feature Pack 2Offer prices, or default contract prices, are indexed directly from the default contract of the owning store.
  • Feature Pack 7 or laterList prices are indexed directly from the LISTPRICE or OFFER database tables, depending on the price source.
  • Feature Pack 8Contract prices are calculated based on the selected contract and then indexed in WebSphere Commerce search in the Catalog Entry index.
  • Feature Pack 8In addition to the pricing methods noted above, you can also calculate contract prices based on the selected contract. They are then indexed in WebSphere Commerce search in either the Catalog Entry index or the Price extension index, depending on the number of contracts your site contains, or the source of the price data.

Indexed prices are populated quickly, but not evaluated dynamically. To ensure that the storefront displays accurate prices, you can change the price mode to suit your business needs. For more information, see Changing price modes between WebSphere Commerce search versions.

When working with prices and currencies in WebSphere Commerce search, a separate index column is used by default to handle multiple currencies.

Feature Pack 8

Indexing prices

You can index price data into the following locations, based on the number of contracts your site contains, or the source of the price data:
  • In the Catalog Entry index, when your site contains less than 1000 contracts and price data is contained within WebSphere Commerce. Prices are calculated and indexed using the di-calculateprice utility and ContractPriceCalculate job command.
    Note: You only need to run the di-calculateprice utility if priceMode = 1 (indexed) in the STORECONF table.

    The di-calculateprice utility updates the information in the price index on demand based on the pricing model your store uses. For more information, see Building the WebSphere Commerce search contract price index.

    The ContractPriceCalculate job command is used for calculating prices on a schedule for all catalog entries that belong to a specific master catalog. The catalog entry price is calculated against all contracts that belong to the store. For more information, see Creating and scheduling the ContractPriceCalculate job.

  • Feature Pack 8In the Price extension index, when your site contains more than 1000 contracts, or if you use an external source to populate prices. Prices are indexed using Index Load, as it can populate a large amount of data into a separate extension index faster than the Catalog Entry index can index price data. For more information, see Index Load.
Feature Pack 8

Calculating prices

Prices can be calculated either fully, or for a specified catalog entry, contract, or currency. When full price recalculations are used, all prior price data is removed from the index before the B2B contract prices are recalculated.

To help decide when and where to calculate prices, consider the following options:
Dedicated server or environment
Allocate a dedicated server or instance to calculate prices.
You can either use the di-calculateprice utility or ContractPriceCalculate job after the price feed is available on the WebSphere Commerce database. Preprocess the master index after the calculation is complete.
In this configuration, calculating prices has no performance impact on the WebSphere Commerce node.
Non-staging environment
Calculate prices on a managed WebSphere Commerce node.
Preprocess the price index after calculation is complete, which saves the price index into a master index server. Then, prices and other data within the catalog entry and catalog group index are replicated to the search slaves.
In this configuration, calculating prices impacts the performance of the managed WebSphere Commerce node, as traffic is served from this environment. However, no additional topology changes are required, thus remaining compatible with earlier feature pack versions.
Staging environment
Calculate prices on a WebSphere Commerce node on staging.
Preprocess the price index to the search node on staging, then run the indexprop utility to replicate the index to the repeater.
In this configuration, no additional topology changes are required, thus remaining compatible with earlier feature pack versions.
Feature Pack 8

Full price recalculations logic

  • Recalculating prices uses current and future store contracts that share the master catalog.
  • Only the supported currencies for all active stores that are identified in the master catalog are respected, while others are ignored and not indexed. This is because the prices are recalculated on behalf of the site administrator, and therefore cannot calculate any customer segment-level pricing.
  • Price calculations are only based on the quantities that are the following amounts: A numeric amount of 1, or a unit of C62. Any step-level pricing, that is, quantity-based pricing, is skipped.
Feature Pack 8

Recalculations logic

  • Contract IDs are not validated when passed in as a separate parameter, so that future contracts show the correct prices when you preview a future date in store preview.
  • All expired and suspended contracts are safe to remove from the TI_CNTRPRICE temporary table for the specified catalog entry or contract that is specified in the utility 's parameters. That is, the purge list is only limited to the specified catalog entry or contract. For example, if you specify an expired contract, all catalog entries that are covered by that contract are purged. However, if you specify a catalog entry, all expired contracts are purged only for the specified catalog entry.
  • If a contract is suspended and inactive, the contract price is removed. If a business user resumes the contract and it becomes active again, the price is not shown in the storefront until the price is calculated again for the resumed contract.
  • When an invalid product, contract or currency is passed in, the logic ignores, and therefore does not index invalid values.
  • If a contract passed in is expired or suspended, it is deleted and purged from the calculation result. Otherwise, if a contract that will be active at a future date is passed in, it is indexed. That is, even though it is not currently active at the time of the price recalculation.
  • The storeId and currency parameters cannot be specified with any other parameters.
Feature Pack 8

Customization logic

Active and future contract prices are built into the catalog entry index using field definitions that start with price_, followed by a combination of contract and currency. For example, price_USD_10001 or price_CNY_10002. In contrast, for releases without indexed contract prices, the catalog entry index uses field definitions that start with price_, followed only by its currency.

The di-calculateprice utility and ContractPriceCalculate job command resolve all deployed contracts for stores that share the specified master catalog. Then, they initialize the price API command to calculate prices for all the catalog entries that belong to the specified master catalog. The calculated price result is saved into the TI_CNTRPRICE_#INDEX_SCOPE temporary table. All the calculated results for a catalog entry are composed into a single column:

TI_CNTRPRICE_#INDEX_SCOPE

Name Type Description
CATENTRY_ID BIGINT NOT NULL The ID of the catalog entry. This column contains all catalog entry for the specified master catalog.
PRICE CLOB Multiple value pairs for different contracts and currency values that are separated with white space.
The NameValuePairTransformer is the default transformer that transforms the wide multiple value column into the dynamic price field. You can generate different dynamic price column names in Solr by customizing or creating a new transformer. If you customize the transformer, you must override the applyFieldNamingPattern method in the following classes to get the updated price column names:
  • SolrRESTSearchCatalogEntryViewPriceQueryPostprocessor
  • SolrRESTSearchByPriceExpressionProvider
  • SolrSearchResultFieldQueryPreprocessor
  • SolrSearchFacetQueryPreprocessor

In extended sites, the catalog asset store defines the price in the master catalog so that extended sites share the catalog asset store's prices. Or, the extended site can override the prices so that it contains the extended site-specific prices. Different extended sites can create specific items with specific price. When prices are calculated, the store-specific items are calculated first, then the shard items are calculated. Shared items are each calculated per store by their specific contract and currency. The price API gets the correct price, based on the specified contract, price rule, price model, or contract terms and conditions. Different extended sites can define different prices by using different contract. When a shopper logs on to a different extended site store, different contracts are resolved. Then, the shopper sees the relevant prices in the store, even for the same product in the master catalog.

Multiple price columns are set up in the catalog entry index. When a buyer logs on to the storefront, the eligible buyer contract is retrieved. If there are multiple eligible contracts, the buyer can select a contract to set for the session. Then, the corresponding price column that is related to the contract in session is displayed in the storefront. To customize this behavior, the ContractPriceCalculate URL uses ContractPriceCalculateCmd as the overall entry command. The logic can be overridden by a registering a new command implementation in the command registry table. If you want to introduce different calculation logic, override the calculateStoreSpecificItemPrice and calculateSharedItemPrice methods in the ContractPriceCalculateCmd command.

The IBM_Admin_CalculatePriceIndex access profile is used to bootstrap the common entry of the com.ibm.commerce.price.commands.CompositeGetContractUnitPriceCmdImpl price API:

<cmdreg storeent_id="0" interfacename="com.ibm.commerce.price.commands.GetContractUnitPriceCmd+IBM_Admin_CalculatePriceIndex" 
classname="com.ibm.commerce.price.commands.CompositeGetContractUnitPriceCmdImpl" target="Local"/>
If your store uses the price rule price model, you can use the following command implementation for performance reasons:

<cmdreg storeent_id="0" interfacename="com.ibm.commerce.price.commands.GetContractUnitPriceCmd+IBM_Admin_CalculatePriceIndex" 
classname="com.ibm.commerce.price.commands.PriceRuleGetContractUnitPriceCmdImpl" target="Local"/>

If your store uses the external price model, you can register your own price command to get your intended price result.

Feature Pack 8

Workspace preview

When working with workspace preview:
  • B2B prices that are shown in store preview are only from approved content.
  • Future prices can be previewed provided that the appropriate future contract is indexed. The future date is respected in the preview context and shows the correct contract for viewing.
  • Prices cannot be associated with new non-approved content, such as previewing a non-approved new product that does not belong to any contract.
  • To ensure that workspace previews are accurate, set up the ContractPriceCalculate job to run regularly. Then, set up an event-consumer trigger to perform a delta product index update for the affected products to pick up the new price changes.