Creating Entry Point Files for SuiteCommerce Modules
Entry point files are essential for SuiteCommerce modules, connecting them to the application and enabling functionality.
The entry point file plays a crucial role in integrating your module with the SuiteCommerce Advanced (SCA) and Site Management Tools (SMT). It establishes the necessary connection for modules to function correctly within the SCA architecture.
Key Aspects of Entry Point Files
- The entry point file can be created as either a JavaScript or TypeScript file depending on your project needs.
- The file must be created in the JavaScript directory of your CCT module.
Steps to Create the Entry Point File:
-
Create a New JavaScript or TypeScript File
Place the file in your CCT module's JavaScript directory, naming it intuitively to represent your module.
Examples:- JavaScript:
../SC.CCT.ImageViewer@0.0.1/JavaScript/SC.CCT.ImageViewer.js - TypeScript:
../SC.CCT.ImageViewer@0.0.1/JavaScript/SC.CCT.ImageViewer.ts
- JavaScript:
-
Define Entry Point Dependencies
Include all necessary dependencies in your file.
JavaScript Example:javascriptundefined
define(
'SC.CCT.ImageViewer',
[
'SC.CCT.ImageViewer.View'
],
function (
SCCCTImageViewerView
)
**TypeScript Example:** ```typescript /// <amd-module name="SC.CCT.ImageViewer"/> import SCCCTImageViewerView = require('./SC.CCT.ImageViewer.View'); -
Create the
mountToApp()Method
This method initializes your CCT module, making it available in the application. It includes thegetComponent('CMS').registerCustomContentType()function, which registers your module in SMT.- ID Variable: Should correspond to the CMS content type, in lowercase.
- View Variable: Initializes the view for your module.
JavaScript Example:
javascript1{2 'use strict';3 //@class SC.CCT.ImageViewer4 return {5 mountToApp: function mountToApp (application)6 {7 application.getComponent('CMS').registerCustomContentType({8 id: 'sc_cct_imgageviewer',9 view: SCCCTImageViewerView10 });11 }12 };13});TypeScript Example:
typescript1{2 'use strict';3 //@class SC.CCT.ImageViewer4 export function mountToApp(application) {5 application.getComponent('CMS').registerCustomContentType({6 id: 'sc_cct_imgageviewer',7 view: SCCCTImageViewerView8 });9 }10}; -
Save the File
Important Notes:
- Your source code must not alter the default SC.CCT.Html module as it connects the SCA application to core content types in SMT.
Related Topics:
- [Create Custom Content Types for SMT]
- [Create a Custom Module for Your CCT]
- [Create a View File]
- [Set Up Your ns.package.json and distro.json Files]
This comprehensive guide on creating entry point files ensures you efficiently connect your SuiteCommerce modules within the SCA framework, facilitating smoother implementation and integration.
Frequently Asked Questions (4)
Is it possible to use TypeScript for creating entry point files in SuiteCommerce?
Where should the entry point file be located for a SuiteCommerce module?
Do I need to register my custom content type in the SuiteCommerce Advanced architecture?
Can I modify the default SC.CCT.Html module when implementing my custom entry point file?
Was this article helpful?
More in Commerce
- SuiteCommerce CAPTCHA Configuration Options and Setup
Configure SuiteCommerce CAPTCHA for enhanced security. Enable CAPTCHA for registration, login, guest checkout, and orders.
- Single Sign-On Integration for NetSuite Web Stores
Implement inbound single sign-on integration for NetSuite web stores using SAML or OpenID Connect for seamless access.
- Facets Management for Commerce in NetSuite
Facets management in NetSuite Commerce optimizes item search filters, enhancing performance and improving user experience.
- SuiteCommerce Analytics Data and Cookie Consent Integration
SuiteCommerce Analytics Data enables tracking of shopper behavior. This requires a cookie consent extension for user preferences.
Advertising
Reach Commerce Professionals
Put your product in front of NetSuite experts who work with Commerce every day.
Sponsor This Category