How to add the text in register page which will be updated from configuration record

In JSON

{
    "type": "object",
    "subtab": {
        "id": "RegisterPage_subtab",
        "title": "Register Page",
        "description": "Add the text in register page",
        "group": "extensions"
    },
    "properties": {
        "RegisterPage.addText": {
            "group": "extensions",
            "subtab": "RegisterPage_subtab",
            "title": "Invoice Text",
            "type": "string",
            "nsType": "textarea",
            "description": "Add the text in register page",
            "default": "<div class='login-text'><span class='login-text-header' style='font-weight: bold;'>LOOKING TO PAY AN INVOICE?</span><br>Contact us at<a href='mailto:ordernow@smeincusa.com'> ordernow@smeincusa.com</a> to get access to our payment portal.</div>"
        }
    }
}

In entry point

var LoginRegisterText =  new LoginRegisterTextView({
				container: container
			});
			LoginRegisterText.template = checkoutHeaderSimplified_tpl;
			_(LoginRegisterView.prototype).extend({
				getHeaderView: function getHeaderView() {
					return HeaderSimplifiedView;
				}
			});
			_(LoginRegisterView.prototype.childViews).extend({
				LoginRegisterText: function () {
					return LoginRegisterText;
				}
			})

View file

return Backbone.View.extend({
        getContext: function getContext() {
            let addText = '';
            if (SC.CONFIGURATION.RegisterPage && SC.CONFIGURATION.RegisterPage !== '') {
                addText = SC.CONFIGURATION.RegisterPage.addText !== '' ? SC.CONFIGURATION.RegisterPage.addText : '';
            }
            return {
                addText: addText
            };
        }
    });

In corresponding template file

{{{addText}}}

<div class=”login-text-container” data-view=”LoginRegisterText”></div>

Leave a comment

Your email address will not be published. Required fields are marked *