You could run the promotion engine with an in memory cart with only the product as a lineitem when indexing, and index different values depending on which rewards you get. It will definately make the indexing slower, since you need to run the promotion engine once per product.
Hi Joel,
I am using " promotionEngine.Evaluate(new List<ContentReference> { variationLink })" but I am getting an error, anything missing?
stack trace
at EPiServer.Commerce.Marketing.Internal.PromotionEngineContentLoader.CreateInMemoryOrderGroup(ContentReference entryLink, IMarket market, Currency marketCurrency)
at EPiServer.Commerce.Marketing.PromotionEngine.Evaluate(IEnumerable`1 entryLinks, IMarket market, Currency currency, RequestFulfillmentStatus requestFulfillmentStatus)
at EPiServer.Commerce.Marketing.IPromotionEngineExtensions.Evaluate(IPromotionEngine promotionEngine, IEnumerable`1 entryLinks, ICurrentMarket currentMarket)
at EPiServer.Commerce.Marketing.IPromotionEngineExtensions.Evaluate(IPromotionEngine promotionEngine, IEnumerable`1 entryLinks)
at SnS.Infrastructure.Services.Implementations.CartService.AddPriceToVariation(String code, Decimal price) in D:\WLC-Phase11\src\SnS\Infrastructure\Services\Implementations\CartService.cs:line 793
at SnS.Infrastructure.Services.Implementations.CartService.AddToCart(LineItemLite item) in D:\WLC-Phase11\src\SnS\Infrastructure\Services\Implementations\CartService.cs:line 560
Hi Quan,
we are using default market only so I am only passing variation content link for evaluate method.it throws a null exception.
Advance Thank you,
Hi quan,
My requirement is to display promotion details on the product listing page. You have offer Like buy10 items & 10%off. So I am using evaluate method like below it works fine(it gives promotion details) when the product is in the promotion category if the product is not in the promotion category it throws null l exception? What is an actual use of an evaluate method.How to solve the exception or how to get promotion details for the product?
promotionEngine.Evaluate(new List<ContentReference> { variationLink }, market, market.DefaultCurrency, RequestFulfillmentStatus.All);
When you run evaluate you get a list of reward descriptions for each reward found. If no rewards found, it would be an empty list.
If I were you I'd debug and check the values of the parameters you send it, just verifying that they look okay and that some property that shouldn't be null is null. So check market, marketDefaultCurrency and variationLink.
commerce ver:10.2.5
Hi,
we have using epi discount type "buy x products get discount on all".How can I get product has eligible to get discount to display the offer in the product listing. We have using epi find for search.
Advance Thanks,