Content Flickers or Disappears When Browsing the Product Listing Page

This topic applies to

Applies to

SuiteCommerce Advanced | Kilimanjaro

In some implementations of Kilimanjaro, content added to the site through SMT may render intermittently or disappear and appear briefly on the product listing page. This error does not occur in SMT but does occur in the published content on the site.

This patch overrides CMSadapter.Component.js in the CMSadapter module with the correct code. You can download the code samples described in this procedure here: Kilimanjaro-ContentFlickerPatch.zip.

Note

In general, NetSuite best practice is to extend JavaScript using the JavaScript prototype object. This improves the chances that your customizations continue to work when migrating to a newer 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 CMSadapter.Component.js Override File

  1. Open the Modules/extensions directory and create a subdirectory to maintain your customizations.

    Give this directory a name similar to the module being customized. For example, create Modules/extensions/CMSadapter.Extension@1.0.0

  2. In your new CMSadapter.Extension@1.0.0 directory, create a subdirectory called JavaScript.

    For example: Modules/extensions/CMSadapter.Extension@1.0.0/JavaScript

  3. Copy the following file:

    Modules/suitecommerce/CMSadapter@X.Y.Z/CMSadapter.Component.js

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

  4. Paste a copy in your new module’s JavaScript directory.

    For example: Modules/extensions/CMSadapter.Extension@1.0.0/JavaScript/CMSadapter.Component.js

  5. Open your new copy of CMSadapter.Component.js and locate the following lines:

    var parent_view_instance = cct_container.parent; parent_view_instance.addChildViewInstances(generator, true); self._addViewCctsToRerender(parent_view_instance, generator);
  6. Replace these lines with the following:

    var placeholders = self.getPlaceholderViews('[data-cms-area="' + container_name + '"]'); if (placeholders && placeholders.views) { _.each(placeholders.views, function(parent_view_instance) { cct_container.parent = parent_view_instance; cct_container.container.parentView = parent_view_instance; parent_view_instance.addChildViewInstances(generator, true); self._addViewCctsToRerender(parent_view_instance, generator); }); }
  7. Save the file.

Step 2: Prepare the Developer Tools For Your Customization

  1. Open your Modules/extensions/CMSadapter.Extension@1.0.0 module directory.

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

    Modules/extensions/CMSadapter.Extension@1.0.0/ns.package.json

  3. Build the ns.package.json file using the following code:

    { "gulp": { "javascript": [ "JavaScript/*.js" ] }, "overrides": { "suitecommerce/CMSadapter@X.Y.Z/JavaScript/CMSadapter.Component.js" : "JavaScript/CMSadapter.Component.js" } }

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

  4. Open the distro.json file. This is located in your root directory.

  5. Add your custom modules to the modules object.

    Your code should look similar to the following example:

    { "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/CMSadapter.Extension": "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. Save the distro.json file.

Step 3: Test and Deploy Your Customization

  1. Test your source code customizations on a local server (see SCA on a Local Server) or deploy them to your NetSuite account (see Deploy 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, the content on the product listing page does not flicker or disappear.

Related Topics