Create Extension Files for SuiteCommerce Customization

Creating extension files in SuiteCommerce helps establish a structured approach for cookie preferences management.

·2 min read·View Oracle Docs

Creating extension files in SuiteCommerce allows developers to build custom features with a structured approach. This article outlines how to create a baseline extension that provides the essential files and folder structure necessary for developing a custom cookie management solution.

Folder Structure for Extension Files

To start, you’ll set up a folder structure similar to the following:

none
1MyCookiesExtension
2 \Modules
3 \MainModule
4 \JavaScript
5 NetSuite.MyCookiesExtension.MainModule.js
6 NetSuite.MyCookiesExtension.Banner.View.js
7 NetSuite.MyCookiesExtension.Footer.View.js
8 \Templates
9 netsuite_mycookiesextension_banner.tpl
10 netsuite_mycookiesextension_footer.tpl

Purpose of Each File

The table below explains the role of each file included in the extension:

File NameDescription
NetSuite.MyCookiesExtension.MainModule.jsThis is the entry point of the extension, responsible for instantiating the necessary SuiteCommerce API components and loading views.
NetSuite.MyCookiesExtension.Banner.View.jsThis file provides a view displaying a form where website visitors can set their cookie preferences. This form is positioned above the header of the website.
NetSuite.MyCookiesExtension.Footer.View.jsThis view contains a link that enables users to access the cookie banner, positioned in the footer section of the website.
netsuite_mycookiesextension_banner.tplThis is the template file associated with the banner view, detailing how the banner should be rendered.
netsuite_mycookiesextension_footer.tplThis template file is used for rendering the footer view, coordinating the style and presentation of the footer link.

Setting up these files not only organizes your code but also ensures that each component of your extension serves a distinct function, improving maintainability and clarity for developers.

Best Practices

  • Consistent Naming: Maintain a consistent naming convention for files to improve readability.
  • Modular Approach: Structure your modules logically for easier updates and scaling.

By following these guidelines, you can create a robust foundation for your SuiteCommerce customizations, particularly when handling user cookie preferences on your eCommerce platform.

Conclusion

Creating structured extension files helps ensure efficient development and enhances the user experience through clear functionalities. As you build your custom features, keep these practices in mind to maintain a clean and effective development environment.

Frequently Asked Questions (4)

What is the purpose of the MainModule.js file in SuiteCommerce extensions?
The MainModule.js file serves as the entry point of the extension. It is responsible for instantiating the necessary SuiteCommerce API components and loading the views for the custom extension.
Is it essential to maintain a consistent naming convention for SuiteCommerce extension files?
Yes, maintaining a consistent naming convention for files improves readability and helps developers quickly identify the purpose of each file within the extension.
How should the Modules folder be structured when creating a SuiteCommerce extension?
The Modules folder should be structured logically with subfolders for JavaScript and Templates, each containing relevant files such as NetSuite.MyCookiesExtension.MainModule.js and netsuite_mycookiesextension_banner.tpl.
Can I position the cookie preferences form developed using SuiteCommerce in different parts of the website?
Yes, the form displayed by NetSuite.MyCookiesExtension.Banner.View.js is intended to be positioned above the header, while a link to it can be placed in the footer with NetSuite.MyCookiesExtension.Footer.View.js.
Source: Create Extension Files Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteCloud Development Framework

View all SuiteCloud Development Framework articles →