How find product has eligible for discount or not?

Vote:
 

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,

#193863
Edited, Jun 06, 2018 14:51
Vote:
 

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.

#193864
Jun 06, 2018 15:10
Vote:
 

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

#193865
Edited, Jun 06, 2018 15:25
Vote:
 

What is the exception exactly?

#193872
Jun 06, 2018 19:17
Vote:
 

Null exception I think...

#193874
Jun 06, 2018 19:19
Vote:
 

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,

#193908
Jun 07, 2018 14:42
Vote:
 

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);

#193917
Edited, Jun 07, 2018 15:16
Vote:
 

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.

#193920
Jun 07, 2018 15:57
Vote:
 

Thank you Joel,

Evaluate works well when the product is in the promotion category but the product not in the promotional category means it will throw a null exception.

#193928
Jun 07, 2018 16:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.