on 05-02-2016 11:40 AM
Hello All, I create a new promotion restriction. It depends on payment type. When user change the payment type the promotion is updated and the cart is recalculated. Everything works ok. I add a peace of code in the changemethod of payment.
final PromotionGroupModel group = ebebekPromotionService.getDefaultPromotionGroup();
promotionservive.updatePromotions(Collections.singletonList(group), sessionCart, true, AutoApplyMode.APPLY_ALL,
AutoApplyMode.KEEP_APPLIED, Helper.getDateNowRoundedToMinute());
getCustomCheckoutFacade().recalculateCart();
It works ok, but sometimes an error appears like;; [de.hybris.platform.promotions.jalo.PromotionsManager] Failed to updatePromotions item 8978427548565 no longer valid (was removed): object no longer valid at de.hybris.platform.jalo.Item$CachedGetter.get(Item.java:680)
I checked with pkanalyzer what is the type of item that couldnt be found; it is type of AbstractPromotionAction.
I thought that there is something that i missed in updatepromotions and recalculate process. What is the best way to update promotions and recalculate cart totals.
Also, getCustomCheckoutFacade().recalculateCart(); this line of code doesnt effect the cart totals, i need to reflesh the page to make the cart is updated in the fronent. Is there anyway to update the cart in the storefront without refleshing the page.
I hope that my question is clear.
Regards, Adem
I dont know what your custom getCustomCheckoutFacade().recalculateCart() is doing, however the important point is to ensure that your custom code uses de.hybris.platform.commerceservices.order.CommerceCartCalculationStrategy which does:
cart calculation
updates promotions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.