on 2020 Nov 25 10:18 AM
I have the below snippet and for now I have configured the custom message inside the "<editorArea:custom>"
But I need this text / message to be picked up from the property file and it need to be displayed in the editor area based on certain condition, for example if the edited product has some attribute value as true or false.How can I do that ???
<context merge-by="type" parent="GenericItem" type="Product" component="editor-area" module="pcmbackoffice"
principal="group1,group2">
<editorArea:editorArea xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea">
<editorArea:essentials>
<editorArea:essentialSection name="hmc.essential">
<editorArea:custom>
<editorArea:default>THIS IS A TEST. IT HAS SUCCEEDED.</editorArea:default>
</editorArea:custom>
<editorArea:attribute qualifier="code"/>
<editorArea:attribute qualifier="batchCountry"/>
<editorArea:attribute qualifier="name"/>
<editorArea:attribute qualifier="shortName"/>
<editorArea:attribute qualifier="manufacturerName"/>
<editorArea:attribute qualifier="catalogVersion"/>
<editorArea:attribute qualifier="approvalStatus"/>
</editorArea:essentialSection>
</editorArea:essentials>
</editorArea:editorArea>
</context>
Request clarification before answering.
Hi khajamohiddin
Thanks a lot for your prompt response and I was able to achieve the same by following your steps.
I did the following stuff
xx-backoffice-config.xml
<context merge-by="type" parent="GenericItem" type="Product" component="editor-area" module="pcmbackoffice"principal="grp1,grp2">
<editorArea:editorArea xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea">
<editorArea:essentials>
<editorArea:essentialSection name="hmc.essential">
<editorArea:customPanel name="groupProductStaticMsgRenderer" spring-bean="groupProductStaticMsgRenderer" />
<editorArea:attribute qualifier="code"/>
<editorArea:attribute qualifier="batchCountry"/>
<editorArea:attribute qualifier="name"/>
<editorArea:attribute qualifier="shortName"/>
<editorArea:attribute qualifier="manufacturerName"/>
<editorArea:attribute qualifier="catalogVersion"/>
<editorArea:attribute qualifier="approvalStatus"/>
</editorArea:essentialSection>
</editorArea:essentials>
</editorArea:editorArea>
</context>
xx-backoffice-spring.xml
<alias name="defaultGroupProductStaticMsgRenderer" alias="groupProductStaticMsgRenderer" />
<bean id="defaultGroupProductStaticMsgRenderer" class="com.xx.backoffice.renderers.GroupProductStaticMsgRenderer" parent="abstractEditorAreaComponentRenderer"/>
Java class :
public class GroupProductStaticMsgRenderer extends AbstractEditorAreaPanelRenderer<ProductModel> {
private static final Logger LOG = LogManager.getLogger(GroupProductStaticMsgRenderer.class);
public static final String GROUP_PRODUCT_STATIC_MESSAGE = "hmc.group.product.alert";
private WidgetInstanceManager widgetInstanceManager;
public GroupProductStaticMsgRenderer() {
}
public void render(Component parent, AbstractPanel abstractPanel, ProductModel model, DataType dataType, WidgetInstanceManager widgetInstanceManager) {
if (!(model instanceof ProductModel)) {
this.widgetInstanceManager = widgetInstanceManager;
final GenericVariantProductModel source = (GenericVariantProductModel) model;
if (source.getBaseProduct().isDefaultBase() == true) {
Div panel = new Div();
Label label = new Label(Labels.getLabel(GROUP_PRODUCT_STATIC_MESSAGE));
label.setParent(panel);
parent.appendChild(panel);
}
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.