Categories Do Not Display Properly

This topic applies to

Applies to

SuiteCommerce Advanced | Kilimanjaro


In some implementations of the Kilimanjaro release of SuiteCommerce Advanced, the parent of a product category would incorrectly overwrite the data of a child category when it displays the child category. This could result in a Page Not Found (404) or the display of the wrong category.

The fix in this patch sets the data for a category correctly, no matter if the category data came first or the overwrite data from the parent came first.

To implement this patch, create a custom module to override Categories.Model.js, which is part of the Categories module. You can download the code samples described in this procedure here:


In general, NetSuite best practice is to extend JavaScript using the JavaScript prototype object. This improves the chances that your customizations with continue to work when migrating to a new version of SuiteCommerce Advanced. However, this patch requires you to modify a file in a way that you cannot extend, and therefore requires you to use a custom module to override the existing module file. For more information, see Customize and Extend Core SuiteCommerce Advanced Modules.

Step 1: Create the Override File

  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/CategoriesExtension@1.0.0.

  3. In your new CategoriesExtension@1.0.0 directory, create a folder titled SuiteScript.

    For example: Modules/extensions/CategoriesExtension@1.0.0/SuiteScript

  4. Copy the following source file and paste into the correct location:

    Copy This File:

    Place a Copy Here:



    In this example, X.Y.Z represents the version of the module in your implementation of SuiteCommerce Advanced.

  5. Open your new copy of Categories.Model.js and locate the following lines:

    if (cat) { if (cat.isprimaryurl === 'T') { cat.idpath = category.idpath; cat.canonical = cat.fullurl; } else { cat.canonical = category.fullurl; } } else { categories[line.getValue('internalid')] = category; }
  6. Replace these lines with the following code:

    if (cat) { if (category.isprimaryurl === 'T') { cat.canonical = category.fullurl; } if (categoryIds && categoryIds.fullurl === category.fullurl) { cat.idpath = category.idpath; } } else { category.canonical = category.fullurl; categories[line.getValue('internalid')] = category; }
  7. Save the file.

Step 2: Prepare the Developer Tools For Your Customization

  1. Open your Modules/extensions/CategoriesExtension@1.0.0 module directory.

  2. Create a file in this directory titled ns.package.json.


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


    You must replace the string X.Y.Z with the version of the module in your implementation of SuiteCommerce Advanced.

    { "gulp": { "javascript": [ "JavaScript/*.js" ] }, "overrides": { "suitecommerce/Categories@X.Y.Z/SuiteScript/Categories.Model.js" : "SuiteScript/Categories.Model.js" } }
  4. Open the distro.json file. This file is located in your root directory.

  5. Add your custom module to the modules object.

    Your code should look similar to:

    { "name": "SuiteCommerce Advanced Kilimanjaro", "version": "2.0", "isSCA": true, "buildToolsVersion": "1.3.1", "folders": { "modules": "Modules", "suitecommerceModules": "Modules/suitecommerce", "extensionsModules": "Modules/extensions", "thirdPartyModules": "Modules/third_parties", "distribution": "LocalDistribution", "deploy": "DeployDistribution" }, "modules": { "extensions/CategoriesExtension": "1.0.0", "extensions/MyExampleCartExtension1": "1.0.0", ...

    This step 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. Save the distro.json file.

Step 3: Test and Deploy Your Customization

  1. Before you deploy, run the following command to compile and deploy the ssp-libraries:

    gulp --source ssp-libraries 
  2. Deploy your source code customizations to your NetSuite account and test the functionality. See Deploy to NetSuite for details.


    Since this patch modifies a SuiteScript file, changes are not visible in your local environment. SuiteScript files run on the server and must be deployed to NetSuite to take effect.

  3. Confirm your results.

    Upon successful deployment, both parent categories and their associated child directories display correctly.

Related Topics