Step 1. Override the Item.Details.View.js File
- 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.
- 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
- In your new ItemDetailsExtension@1.0.0 directory, create a subdirectory called JavaScript.
- Copy the following file into this directory:Modules/suitecommerce/ItemDetails@X.Y.Z/JavaScript/Item.Details.View.js
- 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
- 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.
- Create a file in this directory and name it
ns.package.json.Modules/extensions/ItemDetailsExtension@1.0.0/ns.package.json - 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
- 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.
- Confirm your results. Upon successful deployment, all the required
divelements appear on the Product Details Page.