on 2024 Jan 10 1:13 PM
I have a requirement where I want 2 promotion groups to be assigned to a BaseSite. Since OOTB allows only one promo group per site, How do I achieve it? Thanks in advance.
Request clarification before answering.
This is not possible by default, but luckily PromotionsService's updatePromotions method takes a collection of PromotionGroupModel as its parameter, so I believe this method should work for multiple promotion groups. I did not test it so you need to test it to see whether it works or not.
If it works, what you can do to achieve multiple promotion groups to be assigned to a BaseSite is as follows:
1. Create a many-to-many relation between BaseSite and PromotionGroup
2. Extend DefaultCommerceCartCalculationStrategy with CustomCommerceCalculationStrategy
3. Override getPromotionGroups() method according to your need, it's up to you, some possible scenarios I can think of
4. Define spring bean for your custom strategy and alias for commerceCartCalculationStrategy
<alias alias="commerceCartCalculationStrategy" name="customCommerceCartCalculationStrategy"/>
<bean id="customCommerceCartCalculationStrategy" parent="defaultCommerceCartCalculationStrategy"
class="com.customextension.order.impl.CustomCommerceCartCalculationStrategy">
</bean>
Hope this helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
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.