If you're going to add a new module in this method...
# suitecommerce
s
If you're going to add a new module in this method, you will need to ensure that view has extended the Wizard.Module class
c
I have extended the same in the view
Here is my code:
// @module AVT.StripePaymentGateway.StripePaymentGateway define('AVT.StripePaymentGateway.StripePaymentGateway.View' , [ 'Wizard.Module' , 'avt_stripepaymentgateway_stripepaymentgateway.tpl' , 'Utils' , 'Backbone' , 'jQuery' , 'underscore' ] , function ( WizardModule , avt_stripepaymentgateway_stripepaymentgateway_tpl , Utils , Backbone , jQuery , _ ) { 'use strict'; // @class AVT.StripePaymentGateway.StripePaymentGateway.View @extends Backbone.View return WizardModule.extend({ template: avt_stripepaymentgateway_stripepaymentgateway_tpl , initialize: function (options) { /* Uncomment to test backend communication with an example service (you'll need to deploy and activate the extension first) */ this.message = ''; // var service_url = Utils.getAbsoluteUrl(getExtensionAssetsPath('services/StripePaymentGateway.Service.ss')); // jQuery.get(service_url) // .then((result) => { // this.message = result; // this.render(); // }); } , events: { } , bindings: { } , childViews: { } //@method getContext @return AVT.StripePaymentGateway.StripePaymentGateway.View.Context , getContext: function getContext() { debugger; //@class AVT.StripePaymentGateway.StripePaymentGateway.View.Context this.message = "test" return { message: this.message }; } }); });
Getcontext is triggering well and after getcontext I'm seeing empty screen
s
Hmm, I can't see anything obviously wrong. I would doublecheck that the files are being included in manifest and to try restarting your local server
c
The error got resolved now. I have removed initialize function its working fine. But why it is happening any idea ? @Steve Goldberg
s
Ah, that makes sense
You're extending the wizard module which has its own
initialize()
. If you add an
initialize()
method to your extended version, it will overwrite it
c
Then how can I use Initialize function in my current view steve?
I have some logic which wants to trigger when page loads. I want to write that in initialize function. But I'm facing an issue here. Is there any alternative solution? @Steve Goldberg
s
Well, off the top of my head you can use
_.wrap()
but I am unsure if that is the best way
c
ok Thanks! Can we use checkout events here?
As an alternative solution?
s
I am unsure how they work, they are undocumented.