CSS Error Hides First div Element on Product Details Page

In some implementations of SCA, the CSS hides the first div element, which typically includes the product description on the product details page. As a result, the content in the product description is excluded from the output of the SEO Page Generator, which can affect the SEO ranking for the product.

This patch adds an additional check to validate that the Page Generator generates the content and then unhides the div. To implement this patch, you must override a view file in the ItemDetails module. You can download the code samples described in this procedure here: CSSHidesFirstDiv.zip.

Note:

In general, best practice is to extend JavaScript using the JavaScript prototype object. This ensures 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 that you cannot extend, and you must use a custom module to override the existing module file. For more information, see Develop Your SCA Customization.

Step 1. Override the Item.Details.View.js File

  1. To override the Item.Details.View.js file, located in the ItemDetails module, create a directory in which to store your custom modules.

    For example, Modules/extensions.

  2. Open this 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/ItemDetailsExtension@1.0.0

  3. In your new ItemDetailsExtension@1.0.0 directory, create a subdirectory called JavaScript.

  4. Copy the following file into this directory:

    Modules/suitecommerce/ItemDetails@X.Y.Z/JavaScript/Item.Details.View.js

  5. Open your new Item.Details.View.js file and make the following change:

    Locate the following JavaScript code:

                    if(!overflow)
    {
        this.$('.item-details-more').hide();
    } 
    
                  

    Replace it with the following JavaScript code:

                    if(!overflow && !SC.isPageGenerator())
    {
        this.$('.item-details-more').hide();
    } 
    
                  
  6. Save Item.Details.View.js .

Step 2. Prepare the Developer Tools for Your Override

  1. Set up the ns.package.json file for your custom module and modify distro.json to include the custom module.

    Open the Modules/extensions/ItemDetailsExtension@1.0.0 module directory.

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

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

  3. Build the ns.package.json file using the following code (where X.Y.Z indicates the current version of your module in SuiteCommerce) :

                    {
        "gulp": {
            "javascript": [
                "JavaScript/*"
            ]
        },
          "overrides": {
            "suitecommerce/ItemDetails@X.Y.Z/JavaScript/Item.Details.View.js" : JavaScript/Item.Details.View.js",
          }
    } 
    
                  
  4. Save the ns.package.json file.

  5. Open the distro.json file.

    This file is located in the top-level directory of your SuiteCommerce Advanced source code.

  6. In distro.json , add your custom module to the modules object.

    Your code should look similar to the following example:

                    {
        "name": "SuiteCommerce Advanced Vinson Release",
        "version": "2.0",
        "buildToolsVersion": "1.2.1",
        "folders": {
            "modules": "Modules",
            "suitecommerceModules": "Modules/suitecommerce",
            "thirdPartyModules": "Modules/third_parties",
            "distribution": "LocalDistribution",
            "deploy": "DeployDistribution"
        },
        "modules": {
             "extensions/ItemDetailsExtension":  "X.Y.Z",
             ... 
    
                  
  7. 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.

Step 3. Test and Deploy Your Override

  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, all the required div elements appear in the Product Details Page.

Related Topics

SCA Patches

General Notices