Hi all, I have created a view by extending Wizard....
# suitecommerce
k
Hi all, I have created a view by extending Wizard.module but it is not showing in checkout. How to show the created view in checkout?
p
@Steve Goldberg I am following this guide to create an extension and everything works as expected, except that the value from the HTML input is not picked by SCA. When I click on Continue in OPC (before Review step) I notice the HTTP request already is missing the custom input data. I am using 2019.2, any idea why? The documentation states I just have to create the transaction body field, set appropriate config like show for Sale and Webstore, Role permission in Commerce. And then just set the input field name to the field's name in NetSuite.
I've also added listed the field in Commerce > Config > Advanced, Sales Order Fields.
s
I think you need to track down where it's not being picked up. For example, is it being added to the model? Is it being included in the payload that is being sent to the server? When the server receives it, is it doing anything with the data?
p
Seems like the example does not include a Model. In the template
Copy code
model.options.custbody_preferred_date
shows always empty. The first payload sent to the server seems to have the field listed, but it's missing the value.
@Steve Goldberg
I double checked the article and the repository. Seems like something is odd, at least for 2019.2.
I am not sure if the extension in the example is supposed to work without the model, even on recent versions, it seems something is missing. Perhaps, it worked for you because you tested the code after creating the field with the SC Custom Fields Extension installed? But then, the article does not indicate the extension is required for the code to work. @Steve Goldberg
s
OK, let's step back here so I understand exactly what is working and what isn't.
When a user enters a value into the field and then continues to the checkout, is it being included in the model? This is before you click order submit but after going through to the final step
I'm sorry, I just don't understand exactly what isn't working.
p
So that's the field I am adding in the opc step.
Order Notes.
You add text in there but when you click continue and you can see the payload will show empty value for that field.
s
OK so that means that the field is not being paired with the data model
Have you added the
name
attribute to the input field and it matches the custom field ID?
p
Yes, they match.
message has been deleted
message has been deleted
This is the payload in case you are curious.
s
OK, and your view is extending Wizard.Module?
p
Indeed, yes.
s
OK why are you including a new model
p
For now that's just part of the boilerplate code.
s
So you're not setting that as the model of this view?
I've just reactivated this extension on an 2019.1 site and it works just fine
I would double check that you've edited the right configuration record, because I sometimes edit the wrong domain by mistake
p
I am trying to detach the model the boilerplate created to see if that's the issue.
s
message has been deleted
OK, just to be absolutely clear: you must not set a model on the view that extends WizardModule or it will not work
Because otherwise you will be setting a property on that model and not the LiveOrder model
p
That did the trick Steve, thanks for the help!