on 2021 Jan 20 11:09 AM
Hi All,
I have a requirement where i need to collect key selling points of the product using product wizard creation
And I have declared the following snippets in the back office xml
<context component="create-wizard" type="Product" merge-by="type"> <wz:flow id="ProductWizard" title="create.title(ctx.TYPE_CODE)"> <wz:prepare id="kspcreateWizardPrepare" > <wz:initialize property="keySellingPointData" template-bean="keySellingPointData" /> </wz:prepare> ...rest of the code continued....
here,keySellingPointData is the pojo kind of class that I have and it will have following attributes in it and its getter and setter methods.
public class KeySellingPointData { private String keySellingPoint1; private String keySellingPoint2; private String keySellingPoint3; private String keySellingPoint4; private String keySellingPoint5;
I am collecting these attribute values in step2 in create wizard and the declaration is done like this in the config xml
<wz:step id="step2" label="create.product.keysellingpoint.label"sublabel="create.product.descriptions.sublabel" merge-mode="replace"> <wz:content id="step2.content"> <wz:property-list root="keySellingPointData" > <wz:property qualifier="keySellingPoint1" type="java.lang.String" label="hmc.section.product.ksp.keysellingpoint1"/> <wz:property qualifier="keySellingPoint2" type="java.lang.String" label="hmc.section.product.ksp.keysellingpoint2"/> <wz:property qualifier="keySellingPoint3" type="java.lang.String" label="hmc.section.product.ksp.keysellingpoint3"/> <wz:property qualifier="keySellingPoint4" type="java.lang.String" label="hmc.section.product.ksp.keysellingpoint4"/> <wz:property qualifier="keySellingPoint5" type="java.lang.String" label="hmc.section.product.ksp.keysellingpoint5"/> </wz:property-list> </wz:content> <wz:navigation id="step2.navigation"> <wz:cancel> <wz:revert property="newProduct.picture" /> <wz:revert property="newProduct.thumbnail" /> <wz:revert property="newProduct.logo" /> <wz:revert property="newProduct" /> <wz:revert property="keysellingPointData" /> </wz:cancel> <wz:back/> <wz:custom label="create.product.keysellingpoint.label.next" handler="keySellingPointHandler"> <wz:save property="newProduct"/> </wz:custom> </wz:navigation></wz:step>
As you can see I have declared and handler keySellingPointHandler and its getting called fine when I move to step 3, however the data being entered in the step 2 is not coming into the handler which is declared below
public class KeySellingPointHandler implements FlowActionHandler {
private static final String MODEL_WIZARD_DATA = "keySellingPointData";
@Resourceprivate NotificationService notificationService;
@Resourceprivate VariantToBaseProductCloneStrategy variantToBaseProductCloneStrategy;
@Resourceprivate ModelService modelService;
private static final Logger LOG = LoggerFactory.getLogger(KeySellingPointHandler.class);
@Overridepublic void perform(CustomType customType, FlowActionHandlerAdapter adapter, Map<String, String> map) {
String msg = Labels.getLabel("backoffice_rejected_ksp_failure");
ProductModel product = (ProductModel)adapter.getWidgetInstanceManager().getModel().getValue("newProduct", ProductModel.class);
final KeySellingPointData keySellingPointData = (KeySellingPointData) adapter
.getWidgetInstanceManager().getModel()
.getValue(MODEL_WIZARD_DATA, KeySellingPointData.class);
when it comes to this point " final KeySellingPointData keySellingPointData " the value is coming null.So not sure what is the issue here.
But when I do adapter.getWidgetInstanceManager().getModel() I am getting below results,

however below code is not giving me resuts
final KeySellingPointData keySellingPointData = (KeySellingPointData) adapter
.getWidgetInstanceManager().getModel()
.getValue(MODEL_WIZARD_DATA, KeySellingPointData.class);
Please let me know what is the mistake I am making.Appreciate your time and help.
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.