Skip to Content
0
Jul 09, 2016 at 01:05 PM

Error Failed to update Promotions

193 Views

Hello Experts,

We are facing issue on custom promotion "ProductFinancialOfferPromotion extends ProductPromotion" created in our application. Below is the JALO Layer evaluate () implemenation class @Override public List evaluate(final SessionContext ctx, final PromotionEvaluationContext promoContext) { final List results = new ArrayList();

     final PromotionsManager.RestrictionSetResult rsr =  this.findEligibleProductsInBasket(ctx, promoContext);
     if ((rsr.isAllowedToContinue()) && (!rsr.getAllowedProducts().isEmpty()))
     {
         final PromotionOrderView view = promoContext.createView(ctx, this, rsr.getAllowedProducts());
         while (view.getTotalQuantity(ctx) > 0L)
         {
             promoContext.startLoggingConsumed(this);
             final PromotionOrderEntry entry = view.peek(ctx);
             final List<PromotionOrderEntryConsumed> consumedEntries = view.consume(ctx, 1L);
             for (final PromotionOrderEntryConsumed poec : consumedEntries)
             {
                 poec.setAdjustedUnitPrice(ctx, 0);
             }
             final PromotionResult result = PromotionsManager.getInstance().createPromotionResult(ctx, this,
                     promoContext.getOrder(), 1.0F);
             result.setConsumedEntries(ctx, promoContext.finishLoggingAndGetConsumed(this, true));
             final PromotionOrderEntryAdjustAction poeac = PromotionsManager.getInstance().createPromotionOrderEntryAdjustAction(ctx, entry.getBaseOrderEntry(), 0);
             result.addAction(ctx, poeac);
             results.add(result);
         }
     }
     else
     {
         promoContext.abandonLogging(this);
     }
     return results;
 }


Here is the exceptions when we are adding the Product on which ProductFinancialPromotion applied

ERROR [hybrisHTTP20] [PromotionsManager] Failed to updatePromotions item 8796093551509 no longer valid (was removed): object no longer valid at de.hybris.platform.jalo.Item$CachedGetter.get(Item.java:661) at de.hybris.platform.jalo.ExtensibleItem.getProperty(ExtensibleItem.java:364) at de.hybris.platform.promotions.jalo.GeneratedPromotionResult.getCertainty(GeneratedPromotionResult.java:208) at de.hybris.platform.promotions.jalo.PromotionResult.getFired(PromotionResult.java:187) at de.hybris.platform.promotions.jalo.PromotionResult.undo(PromotionResult.java:371) at de.hybris.platform.promotions.jalo.PromotionsManager.deleteStoredPromotionResults(PromotionsManager.java:1524) at de.hybris.platform.promotions.jalo.PromotionsManager.updatePromotions(PromotionsManager.java:856) at de.hybris.platform.promotions.impl.DefaultPromotionsService.updatePromotions(DefaultPromotionsService.java:227) at com.soriana.commons.commerceservices.order.impl.TestDefaultCommerceCartCalculationStrategy.calculateCart(TestDefaultCommerceCartCalculationStrategy.java:78) at de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartCalculationStrategy.calculateCart(DefaultCommerceCartCalculationStrategy.java:58) at de.hybris.platform.commerceservices.order.impl.DefaultCommerceAddToCartStrategy.addToCart(DefaultCommerceAddToCartStrategy.java:121) at de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService.addToCart(DefaultCommerceCartService.java:104) at com.Test.facades.order.impl.TestCartFacade.createCombinedCartModificationData(TestCartFacade.java:92) at com.Test.facades.order.impl.TestCartFacade.addToCart(TestCartFacade.java:51) at com.Test.storefront.controllers.misc.AddToCartController.addToCart(AddToCartController.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Appreciate your help.