HCL Commerce Version 9.1.10.0 or later

Push customization to production environment

In this lesson, you will push the customization created in the Auth environment to the Live environment.

Before you begin

Complete the Profit Margin Customization steps in the Auth environment to Upgrade the existing connectors in NiFi .

Procedure

Do the following to push the index from the Auth environment to the Live environment:
  1. Activate the Production Environments with Push to Live (PTL) end to end. This step assumes that you have created the Push-to-Live connectors. If the connectors are not created, see step 4 of Creating a NiFi service connector.
    1. Deploy the Commerce Live environment by following the instructions in the topic Deploying HCL Commerce Version 9.1 with Docker Compose (for non-production usage).
    2. Run the stagingprop utility as below in the Utility server Docker container of the Auth environment:
       ./stagingprop.sh -scope all -dbtype db2 -sourcedb source_db_server:db_port/db_name -sourcedb_user AuthDbUsername -sourcedb_passwd AuthDbPassword -destdb dest_db_server:db_port/db_name -destdb_user LiveDbUsername -destdb_passwd livedbpassword -trace 1
      Note: Refer to Stagingprop Utility for more information.
  2. Depending on the HCL Commerce version you use, the steps to obtain search indices and profit margin values in the live environment differ:
  3. Use a REST client and execute the following POST commands to verify that the search index data are available.
    http://ElasticSearchServerName:30200/live.storeId.product/_search
    1. Ensure that the contents of the Body include the <storeId>, <languageId>, <catalogId>, and <catentryId>​.
    2. Ensure that cost price data is available for the <catentryId> that you are using to verify that the profit margin field is indexed.
      For example, consider the following case:
      
      {
          "query": {
              "term": {
                  "_id": "<storeId>-<languageId>-<catalogId>-<catentryId>"
              }
          }
      }
      Let us consider the corresponding values as:
      • storeId = 1
      • languageId = 1
      • catalogId = 10001
      • catentryId = 10001
      Hence the final product will be:
      Example:
      {
          "query": {
              "term": {
                  "_id": "1--1-10001-10001"
              }
          }
      }
    3. Verify that the profit margin field is indexed as follows:
      
      "prices": {
      	"offer": {
      		"usd": 50.0
      	}
      	"list": {
      		"usd": 50.0
      	}
      	"10001": {
      		"usd": 50.0
      	}
      },
      "custom": {
      	"x_profitMargin": 19.0
      }
  4. Modify the user data field name mapping to map the profit margin field to user data using the configuration API.
    1. Restart Query service.
    2. Execute the following command from the REST Client.
      POST: http:// ElasticSearchHostname:30920/search/resources/api/v2/configuration?nodeName=component&envType=live
      HCL Commerce Version 9.1.6.0 or laterNote: Use envType as auth (if using an authoring environment) or live (if using a production environment).
    3. Use basic authentication username as spiuser and password as spiuserPassword.
      Note: The default password for the spiuser user is passw0rd for HCL Commerce 9.1.0.0 to 9.1.8.0, and QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for HCL Commerce 9.1.9.0 or greater.
    4. For the Body, use the following code:
      {
          "valuemappingservice": {
              "valuemapping": [
                  {
                      "internalName": "CatalogEntryUserDataFieldNameMapping",
                      "externalName": "CatalogEntryUserDataFieldNameMapping",
                      "valuemap": [
                          {
                              "externalValue": "ProfitMargin",
                              "internalValue": "custom.x_profitMargin"
                          }
                      ]
                  }
              ]
          }
      }
      
      Note: The default password for the spiuser user is passw0rd for HCL Commerce 9.1.0.0 to 9.1.8.0, and QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for HCL Commerce 9.1.9.0 or greater.
    5. Click Send request. The configuration should be added for component.
    6. Restart the Query service.
  5. Modify the store to display the profit margin only in store preview.
  6. Validate that the Profit Margin is visible on the Store Preview of the Production Environment.
    Note: There is no need to create the Profit Margin Web Activity, as it is already created by running stagingprop utility and propagating it from the authoring database.