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

Target the cheapest n items from the set 'X' for a promotion

Vote:
 

In trying to extend the standard set of promotions to create a discount of the form Buy any combination of 'n' items from a set of potential items 'X'  and recieve a percentage discount 'p' off the cheapest 'm' items from a set of potential items 'Y'. This is a basic multi-buy promo.

From looking at the blog posts short-brief-about-custom-promotions and Custom-promotion-development in conjunction with examining the expressions from the built in discounts and those created when building your own from commerce manager I cannot see a way to choose a target from a collection serialised in the settings object. It appears the easiest way to do this or similarly complex filters\conditionals would be to add a new method to the RulesContext class. As I understand it this would expose the methods from the 'this' instance in the ExpressionEditor. The documentation for RulesContext implies this is possible.

However from the decompiled code I can see that a custom RulesContext cannot be injected and it appears the only way to do this would be to replace RulesExprValidator (via the market config) and reimplement the Eval method loading an extended RulesContext instance.

I was hoping someone could confirm this understanding or if its incorrect point me at an appropriate blog or documentation page.

Andrew

#121096
May 01, 2015 17:46
Vote:
 

In case anyone else has the same question I have been advised that this is correct. To achieve the desired discount the RulesContext must be extended and loaded via custom RulesExprValidator which can be loaded via the market config

Andrew

#121254
May 05, 2015 18:38
* 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.