cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to extend or add custom populators to an OOTB converter?

ccronquillo
Explorer
0 Likes
3,420

I see that there is an OOTB converter called defaultOrderEntryConverter from commercefacades-spring.xml.

<bean id="defaultOrderEntryConverter" parent="abstractPopulatingConverter">
    <property name="targetClass" value="de.hybris.platform.commercefacades.order.data.OrderEntryData"/>
    <property name="populators">
        <list>
            <ref bean="orderEntryPopulator"/>
        </list>
    </property>
</bean>

What if I have a custom Populator that I want to add on top of what is already provided in here? I cannot just add it to the <list> because this XML is read-only.

Is there a way to "extend" this converter, and then add my custom populator in that one?

Accepted Solutions (1)

Accepted Solutions (1)

mansurarisoy
Contributor

You can use modifyPopulatorList bean for this.

The following is an example from OOTB (acceleratorfacades-spring.xml)

<bean parent="modifyPopulatorList">
<property name="list" ref="orderEntryConverter"/>
<property name="add" ref="cartEntryActionPopulator"/>
</bean>
ccronquillo
Explorer
0 Likes

Thank you, I tried it and it works!!

I have an additional question though... Is it possible to add more than one "add" entry there? I tried it and my Hybris server complains...

mansurarisoy
Contributor

ccronquillo no, ModifyPopulatorList class expects single value for add property. But you can add more than one bean definition for modifyPopulatorList into your customextension-spring.xml

Answers (1)

Answers (1)

marcingrychtol-epam
Discoverer
0 Likes
<bean id="myOrderEntryConverter" parent="defaultOrderEntryConverter">
<property name="populators">
<list merge="true">
<ref bean="myAddedOrderPopulator"/>
</list>
</property>
</bean>