November Happy Hour will be moved to Thursday December 5th.

Functionality to Evaluate promotions on entries

Vote:
 

In the new [BETA] Marketing section is is possible to evaluate promotions to an order or cart (IOrderGroup) 

But in the product detail page of our new store we want to display the discounted price for a promotion (if a valid promotion exists)

Is there functionality planned for the PromotionEngine to Evaluate promotions on a Collection or Single instance of a Entry?

#148297
May 09, 2016 15:52
Vote:
 

Hi,

Yes, that's what we are working on the upcoming version of Commerce - I would expect it to be released in 1-2 weeks (just don't take my words as promises :) )

/Q

#148299
May 09, 2016 16:15
Vote:
 

Hi

Yes, such a functionality available shortly. You will be able to evaluate either a single or a collection of ContentReferences referencing an entry. Those API:s should be included in the next Commerce release.

Regards

Per Gunsarfs

#148300
May 09, 2016 16:17
Vote:
 

Than I will not start Developing this myself. ;)

Thanks for the quick response!

#148301
May 09, 2016 16:29
Vote:
 

There is now a release out that contains this API, http://world.episerver.com/releases/episerver---update-112/. If you give it a try, we welcome any feedback for use cases we might have missed, or that could be handled better.

Regards

Per Gunsarfs

#148578
May 17, 2016 15:58
Vote:
 

I've been working with this and most of it seems to work great. 

I just have one problem. When I target a Campaign to a VisitorGroup, and I run the Evaluate function on the promotionEngine, I get an exception. 

Object reference not set to an instance of an object at EPiServer.Commerce.Marketing.CampaignVisitorGroupFilter.IsInVisitorGroup

This seems to happen because HttpContextBase is null.

In the 'workflows' when added the product to the Cart it all works. 

#150358
Jun 16, 2016 16:09
Vote:
 

Hi Mark

The visitor group filtering does require an http context, since many of the criteria uses it to evaluate if they match or not. However, if no http context exists, it should not fail with a null reference exception. That is a bug, and I'll register that in our systems.

I wonder, where are you calling these methods from? Is it from somewhere where no http context would exists?

Thanks for the report.

Regards

#150360
Jun 16, 2016 16:21
Vote:
 

I was handling my searchresults Asynchronously, so the code to get the price for the products was called from another thread. 

#150362
Jun 16, 2016 16:48
Vote:
 

Right, that makes sense.

We'll fix this by simply ignoring any visitor group checks of campaigns/promotions if there is no http context available. In other words, if the check is run in a scenario where there is no http context, no promotions will be skipped because of the current user not belonging to any of the required visitor groups.

#150364
Jun 16, 2016 17:14
Vote:
 

Hi,

We have met the issue from a partner that if there's no HttpContext then it should be assumed that no visitor groups match and those campaigns should be excluded. So the behavior of above scenario has changes. Now, we'll excluded all campaigns/promotions if there is no http context available.

Regards.

#171993
Edited, Nov 23, 2016 8:54
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.