View a Related Video
When customizing SCA, you may need to change the HTML code of the application. To add, remove, or change the HTML, you must customize the template file for the module that corresponds to the feature you want to change. To customize a template, you must use the override method provided by the developer tools. Since there is no mechanism for overriding or extending a specific part of a template, you must override the entire file.
This example describes how to override a template file to add additional text to the product description page. You can use this example as a guide when customizing your own templates.
To override a template:
Create the directory structure to store your customized template.
Create a directory called
extensions within the
extensions directory, create a subdirectory called
When creating a new custom module, the module name must be unique. You must not have duplicate module names, even if those modules reside in different folders.
ItemDetailsExtension@1.0.0 directory, create a subdirectory called
If required, create another subdirectory called
In general, when creating custom modules, you should create a directory structure similar to that described in the procedure above. See Organize Source Code for Custom Modules for more information.
Copy the original template file to your custom directory.
item_detail.tpl file from
Modules/suite_commerce/ItemDetails@x.y.z/Templates to the
Templates directory of your custom application module. The string
x.y.z corresponds to the version of ItemDetails module in your version of SCA.
You must create this file in the
Add the required code to the
The contents of your
ns.package.json file should be similar to the following:
, "sass": [
You must replace the string
x.y.z in the above example with the version of the ItemDetails module in your version of SCA.
The first section of this example defines the required objects used by gulp to include your customized template and Sass files when combining the application.
The second section contains the override directive which maps the original file in the SCA source distribution directory to your custom template file. In this example, this mapping tells the gulp.js combiner to override a specific file.
Edit your custom template.
This procedure shows the basic steps required to modify a template. However, you can fully customize your templates as required. See Design Architecture for more information.
item_details.tpl file you copied above.
In your editor, search for the string Add to Cart.
This string defines the label for the add to cart button.
Replace this string with the string ’Add to Your Cart.'
Create a custom Sass file, if required.
See Extend a Sass File for more information.
You must add your custom module to the
distro.json file to ensure that the gulp tasks include your custom template. If you are customizing Sass files, you must also add a reference to them in the appropriate location in the
distro.json file. See Extend a Sass File for more information.
Add an entry for the new module in the list of modules in the
modules object as shown below:
"name": "SuiteCommerce Advanced Mont Blanc",
In this example, the ItemDetailsExtension module is added at the beginning of the list of modules. However, you can add the module anywhere in the
modules object. If a module contains only customized template or Sass files, the order of precedence in this list does not matter.
View your changes.
If you are running a local server, you can view your changes by reloading your website. See SCA on a Local Server for more information.
If you are viewing your site in NetSuite, you can deploy your changes using the developer tools. See Deploy to NetSuite for more information.
When viewing your changes, you should see new button label and the item details and item image should be reversed.