on 11-10-2016 6:47 AM
Hi Experts,
We are using hybris 6.2.0, DefaultCommercePlaceOrderStrategy bean resides in commerceservices extension. I need to create a new CustomDefaultCommercePlaceOrderStragey class which extends DefaultCommercePlaceOrderStrategy and override the placeOrder() method .How could i achieve this. Please explain step by step.
I faced the same issue and after spending some time in looking at how DefaultCommerceCheckoutService 's bean is configured I found that it has explicitly specified the dependency for Place order strategy as follows
<property name="commercePlaceOrderStrategy" ref="b2bCommercePlaceOrderStrategy"/>
So for extending a the DefaultCommercePlaceOrderStrategy in B2B store you should always give alias as b2bCommercePlaceOrderStrategy as given in following example:
<alias name="customDefaultCommercePlaceOrderStrategy" alias="b2bCommercePlaceOrderStrategy"/>
Cheers!! 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Write your own class and extend the DefaultCommercePlaceOrderStrategy and override required method then follow the below spring configuration in your extension spring.xml
<alias alias="commercePlaceOrderStrategy" name="newCommercePlaceOrderStrategy"/>
<bean id="newCommercePlaceOrderStrategy"
class="your.new.fully.qualified.classpath" parent="defaultCommercePlaceOrderStrategy"/>
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Phani,
Thank you for the quick reply, I have followed the same steps you have explained but instead of calling my overridden method which is calling original method.Below are my bean definitions. Here RgcCommercePlaceOrderStrategy extends DefaultCommercePlaceOrderStrategy
<bean id="rgcCommercePlaceOrderStrategy"
class="de.hybris.rgc.extend.commerceservice.RgcCommercePlaceOrderStrategy" parent="defaultCommercePlaceOrderStrategy">
<property name="calculationService" ref="rgcCalculationService"/>
</bean>**
I forgot to mention alias bean definition in my earlier comment.It was there in spring configuration file like below
Still it is not calling custom overridden method.
User | Count |
---|---|
5 | |
1 | |
1 | |
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.