Item Search Displays Incorrect Results

In some implementations of the Elbrus release of SuiteCommerce Advanced, the application returns incorrect results when entering more than one term in the search criteria.

The following patch corrects a problem in ItemsSearcher.View.js, which is part of the ItemsSearcher module. To implement this patch, create a custom module to change the defaultOptions.highlightFirst property. You can download the code samples described in this procedure here: ElbrusItemSearchResultsIncorrect.zip.

Note:

Before proceeding, familiarize yourself with Best Practices for Customizing SCA.

Step 1: Extend ItemsSearcher.View.js

  1. Create an extensions directory to store your custom module. Depending on your implementation, this directory might already exist.

  2. Within this directory, create a custom module with a name similar to the module being customized.

    For example: Modules/extensions/ItemsSearcherExtension@1.0.0.

  3. In your new ItemsSearcherExtension@1.0.0 module, create a subdirectory called JavaScript.

    For example: Modules/extensions/ItemsSearcherExtension/JavaScript

  4. In your new JavaScript subdirectory, create a JavaScript file.

    Name this file according to best practices. For example:

    ItemsSearcher.View.Extend.js

  5. Open this file and extend ItemsSearcher.View.js to customize the highlightFirst property from true to false, as shown in the following code snippet.

                    define(
       'ItemsSearcher.View.Extend'
    ,   [
          'ItemsSearcher.View'
       ]
    ,   function (
          ItemsSearcherView
       )
    {
    
    'use strict';
    
    ItemSearcherView.prototype.defaultOptions.highlightFirst = false
    
    }); 
    
                  
  6. Save the file.

Step 2: Prepare the Developer Tools For Your Customization

  1. Open your new ItemsSearcherExtension@1.0.0 module directory.

  2. Create a file in this directory and name it ns.package.json.

    Modules/extensions/ItemsSearcherExtension@1.0.0/ns.package.json

  3. Paste the following code into your new ns.package.json file:

                     {
        "gulp": {
            "javascript": [
                "JavaScript/*.js"
            ]
        }
    } 
    
                  
  4. Open the distro.json file. This is located in your root directory.

  5. Add your custom module to the modules object.

    Your code should look similar to the following example:

                    {
        "name": "SuiteCommerce Advanced Elbrus",
        "version": "2.0",
        "buildToolsVersion": "1.3.0",
        "folders": {
            "modules": "Modules",
            "suitecommerceModules": "Modules/suitecommerce",
            "extensionsModules": "Modules/extensions",
            "thirdPartyModules": "Modules/third_parties",
            "distribution": "LocalDistribution",
            "deploy": "DeployDistribution"
        },
        "modules": {
            "extensions/ItemsSearcherExtension": "1.0.0", 
                   "extensions/MyExampleCartExtension1": "1.0.0",
                 //... 
    
                  

    This ensures that the Gulp tasks include your module when you deploy. In this example, the custom modules are added at the beginning of the list of modules. However, you can add the modules anywhere in the modules object. The order of precedence in this list does not matter.

  6. Add ItemsSearcher.View.Extend as a dependency to SCA entry point within the SC.Shopping.Starter entrypoint of the JavaScript array.

    Your distro.js file should look similar to the following:

                     "tasksConfig": {
    //...
    "javascript": [
             //...
             {
                   "entryPoint": "SC.Shopping.Starter",
                   "exportFile": "shopping.js",
                   "dependencies": [
                      //...
                        "StoreLocator",
                        "SC.CCT.Html",
                        "ItemsSearcher.View.Extend"
                   ],
                               //... 
    
                  
  7. Save the distro.json file.

Step 3: Test and Deploy Your Customization

  1. Test your source code customizations on a local server (see Test SCA Customizations on a Local Server) or deploy them to your NetSuite account (see Deploy SCA Customizations to NetSuite). If you are currently running SCA on a local server, your changes should appear on your local site immediately.

  2. Confirm your results.

    Upon successful deployment, item search strings should display correct results.

Related Topics

SCA Patches

General Notices