How to Navigate to a page with path ‘test’:

Backbone.history.navigate(‘test’, {trigger: true});  Eg:- Navigate to a landing page upon registration of the customer. In the landing page display something like …”Your registration will be reviewed and a representative will contact you”.  Use the below given code for navigation in the required place in the View file “LoginRegister.Register.View.js”  Backbone.history.navigate(‘test’, {trigger: true}); 

How to call POST request using service url – eg

var service_url = Utils.getAbsoluteUrl(getExtensionAssetsPath(‘services/TaxFreeInvoice.Service.ss’)); fetch(service_url, {                   method: ‘post’,                   body: ‘{“fileName”:”‘ + fileName + ‘”,”file”:”‘ + file + ‘”,”invInternalid”:”‘ + invInternalid + ‘”,”fileExtension”:”‘ + fileExtension + ‘”}’,                    headers: {“Content-Type”: “application/json”,”Accept”: “application/json”}                                       }).then(function(response) {                                           return response.json()                }).then(function(res)                {                               var data = res;                                                          if (data.success) {                                              swal(“Success”, “Your… Continue reading How to call POST request using service url – eg

How to extend any method of a view – eg

_.extend(ProductViewsPriceView.prototype,{                template: jj_productpriceview_pricemodule_tpl,                getContext: _.wrap(ProductViewsPriceView.prototype.getContext,function(fn){                               var context = fn.apply(this,_.toArray(arguments).slice(1));                               context.showOnSaleOrigPricelarge = show_onsale_orig_price;                               return context;                                                              }) });

How to extend the events method of a view – eg

_.extend(InvoiceDetailsView.prototype, {                            events: _.extend(InvoiceDetailsView.prototype.events, {                                                      ‘change [data-action=”filechange”]’: ‘filechange’,                                                      ‘click [data-action=”pofile”]’: ‘pofile’                }),                filechange: function(input) {….},                pofile: function(input) {….} }

How to extend the initialize method of a view – eg

_.extend(InvoiceDetailsView.prototype, {                         initialize: _.wrap(InvoiceDetailsView.prototype.initialize, function wrappedInitialize(fn, options) {                                       fn.apply(this, _.toArray(arguments).slice(1));                                      …..         });}

Eg to Add a My Account Menu & MyAccountMenu component

Add a My Account Menu named “Preorders” which redirects to a landing page “test”  using extension.  var myaccountmenu = container.getComponent(“MyAccountMenu”);  if(myaccountmenu)  {   var preordersmenugroup = {       id: “preorders”,       name: “Preorders”,       index: 2,       url: “test”,       permissionoperator: “OR”,       permissions: [           {               group: “transactions”,               id: “TRAN_CUSTINVC”,               level: “1” … Continue reading Eg to Add a My Account Menu & MyAccountMenu component

Eg for cart component and event cancelableOn

                    cart.cancelableOn(‘afterUpdateLine’, function() {                         showModal();                     });                     cart.cancelableOn(‘afterRemoveLine’, function() {                         showModal();                     });                     cart.cancelableOn(‘afterAddLine’,function(){                        showModal();                     })