Creating Entry Point File for Custom Views in SuiteCommerce
Learn how to create an entry point file for custom views in SuiteCommerce to enhance product detail presentation.
To display the Detailed Description (storedetaileddescription) field in SuiteCommerce, you'll need to create an entry point file that manages the rendering of specific child views within the application. This step is crucial for customizing how product details are presented on your eCommerce site.
How to Create the Entry Point File
Step-by-Step Instructions
- Navigate to the
Workspace/CDRExample/Modules/CDRExample/JavaScriptdirectory. - Create a new entry point file named
CDRExample.jsand include the following code:
1define('CDRExample', [2 'CDRExample.View'3], function (4 CDRExampleView5) {6 'use strict';7 8 return {9 mountToApp: function mountToApp (container) {10 var PLP = container.getComponent('PLP');11 12 if (PLP) {13 PLP.addChildViews(PLP.PLP_VIEW, {14 'ItemViews.Price': {15 'CDRExample.View': {16 childViewIndex: 0,17 childViewConstructor: function () {18 return new CDRExampleView({PLP: PLP})19 }20 }21 } 22 })23 }24 }25 }26})Code Explanation
- The code accesses the
PLP(Product List Page) component, necessary for implementing custom views. The access provides you with theaddChildViews()method, which allows for more detailed view injections. - The
addChildViews()method is used instead ofaddChildView()for clarity, as it lets you specify precisely where to inject your new child view, minimizing conflicts with other views.
Key Considerations
- Ensure that you have defined the child view and its template beforehand. For this, refer to the relevant sections on defining views and templates.
- If embedding a child view within a
Backbone.Collection, all views belonging to that collection will display the same child view, which can be beneficial for uniformity across views.
Before You Begin
Before adding a child view, complete the following:
- Choose between Short or Verbose Syntax: You can use
addChildView()for a simple addition oraddChildViews()for detailed placement. - Identify the Placeholder: Knowing where to place the child view is critical. You can use
data-viewordata-cms-areaattributes to identify suitable placeholder areas.
When using a data-cms-area, include the prefix cms: in the value.
Example of Adding a Child View
Here’s an example syntax for adding a child view in a data-cms-area:
pdp.addChildView('cms:header_banner_top', function() { ... });Note: Ensure you reference the relevant guide for further details about creating views and templates for best practices.
Frequently Asked Questions (4)
Is there a specific directory where the entry point file should be created for SuiteCommerce?
What method should be used to add child views for product detail customization in SuiteCommerce?
What should be done before embedding a child view in a Backbone.Collection in SuiteCommerce?
Can you mix short and verbose syntax methods when adding views in SuiteCommerce?
Was this article helpful?
More in Commerce
- Available Items Only Filtering in NetSuite 2026.1
Available items only filtering enhances sales efficiency in NetSuite 2026.1 with Intelligent Item Recommendations.
- Best Practices for Fields and Facets in NetSuite Commerce
Optimize performance in NetSuite Commerce by using fields and facets efficiently, limiting unnecessary data and enhancing user experience.
- SuiteCommerce Updates in NetSuite 2026.1 Release Notes
SuiteCommerce, MyAccount, and Advanced updates introduced in NetSuite 2026.1 enhance eCommerce capabilities and require migration for SCA.
- eCommerce Performance with NetSuite 2026.1 Commerce Extensions
Explore how Commerce Extensions in NetSuite 2026.1 enhance eCommerce performance and user experience with key features and best practices.
