Reaction Commerce Forums

How to override the core template with the custom template


i want additional functionality to be added to one of the core template (gridContent).

What i did was

1.) created custom.html and custom.js (custom template name is mygridContent)similar to the required core template in my plugin.
2.) included this statement in templates.js
Template.mygridContent.replaces(“gridContent”); [as per the following docs]

What happened was… the mygridContent ui has been overridden. and the gridContent helper functions are accessible and my custom template mygridContent helper functions are not accessible.

What I need is … i want mygridContent ui to be overriden and even the mygridContent helpers and events to be accessible.

any suggestions or inputs ?



I think you want to look at this section of the docs for that package. That allows you to not just override the HTML for the template but all of the helpers, etc.


if we use Template.inheritsHelpersFrom what it does is the custom template(mygridContent) will inherit the html and helpers of the core template(gridContent). But we need to call the custom template like {{ > mygridContent }}( mygridContent). here we can add additional functionality to mygridContent template.

what my requirement is : the custom template should override the core template html and helpers. but this should happen when i am calling the core template ie., {{ > gridContent }} and not {{ > mygridContent }}