Difference between revisions of "Order Express Pricing Rules"

From eVision
Jump to: navigation, search
(Every)
m
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Overview ==
+
Test
 
+
[[Order Express]] utilizes a robust expression system designed by [[eVision Services]] which allows for the conditional pricing of items.  These ''pricing rules'' are stored within the database in the <code>PricingRules</code> table.  Rules are written in [[wikipedia:Reverse Polish Notation|postfix notation]], but includes a number of keywords that can be used to retrieve information about the item being priced (such as how a product can be priced differently based on which styles are applied to it.
+
 
+
== Unimplemented Keywords ==
+
 
+
These keywords are considered to be "valid" keywords/tokens within the ''Rules Engine'' but currently have no implementation for pricing rules, and are thus not available for usage in pricing rules.
+
 
+
* <code>C:</code> - Category
+
* <code>COUNT:</code> - Count
+
* <code>E:</code> - Finished End Option Group
+
* <code>EVERY:</code> - Every
+
* <code>H:</code> - Hinging Option Group
+
* <code>LIMIT:</code> - Limit
+
* <code>MAX:</code> - Maximum
+
* <code>MIN:</code> - Minimum
+
* <code>N:</code> - Style Option Selections Count
+
* <code>L:</code> - Product Line
+
* <code>Q:</code> - Style Option Selection
+
* <code>S:</code> - Style Category
+
* <code>SOME:</code> - Some
+
* <code>SUM:</code> - Sum
+
* <code>Z:</code> - Evaluation
+
 
+
== Implemented Keywords ==
+
 
+
The following keywords have a defined meaning within pricing rules and can be used.  Each of the keyboards are shown as links which will take you to their usage instructions.
+
 
+
* <code>A:</code> - [[#Specials|Special]]
+
* <code>D:</code> - [[#Modifications|Modification]]
+
* <code>F:</code> - [[#Nested_Formulas|Formula]]
+
* <code>I:</code>, <code>=></code>, and <code>,</code> - [[#Conditional_Expressions|Conditional]]
+
* <code>M:</code> - [[#Variable_Price_Codes|Variable Price Code]]
+
* <code>O:</code> - [[#Style_Options|Style Option]]
+
* <code>P:</code> - [[#Products|Product]]
+
* <code>R:</code> - [[#Prices|Price]]
+
* <code>T:</code> - [[#Tags|Tag]]
+
* <code>U:</code> - [[#Upcharges|Upcharge]]
+
* <code>V:</code> - [[#Variables|Variable]]
+
* <code>W:</code> - [[#Modification_Variables|Modification Variable]]
+
* <code>X:</code> - [[#Constants|Constant]]
+
 
+
== Usage ==
+
 
+
=== Specials ===
+
 
+
Tokens: <code>A:</code> or <code>Special:</code>
+
 
+
Format: <code>A:?</code>
+
 
+
The format <code>A:?</code> is the equivalent of asking if the current item being evaluated is a special (product).
+
 
+
=== Categories ===
+
 
+
Tokens: <code>C:</code> or <code>Category:</code>
+
 
+
Format: <code>C:[product_category_display_id]</code> or <code>C:[modification_category_display_id]</code>
+
 
+
The value for the <code>[product_category_display_id]</code> parameter should match the <code>ProductCategoryDisplayID</code> in the <code>ProductCategories</code> table. The value for the <code>[modification_category_display_id]</code> parameter should match the <code>ModificationCategoryDisplayID</code> in the <code>ModificationCategories</code> table.
+
 
+
=== Aggregation ===
+
 
+
Tokens: <code>COUNT:()</code>, <code>MAX:()</code>, <code>MIN:()</code>, <code>SUM:()</code>
+
 
+
==== Count ====
+
 
+
Tokens: <code>COUNT:</code>, <code>(</code>, <code>,</code>, <code>)</code>
+
 
+
Format: <code>COUNT:([atoms])</code> or <code>COUNT:[count_greater_or_equal_to]([atoms])</code>
+
 
+
The value for <code>[atoms]</code> is a comma separated list of atoms to test against. Returns the number <code>[atoms]</code> that return true. The value of <code>[count_greater_or_equal_to]</code> changes the return type of this atom into a boolean, where the result is true if the number of <code>[atoms]</code> is greater or equal to the value supplied.
+
 
+
==== Maximum ====
+
 
+
Tokens: <code>MAX:</code>, <code>(</code>, <code>,</code>, <code>)</code>
+
 
+
Format: <code>MAX:([atoms])</code>
+
 
+
The value for <code>[atoms]</code> is a comma separated list of atoms of which to find the largest value.
+
 
+
==== Minimum ====
+
 
+
Tokens: <code>MIN:</code>, <code>(</code>, <code>,</code>, <code>)</code>
+
 
+
Format: <code>MIN:([atoms])</code>
+
 
+
The value for <code>[atoms]</code> is a comma separated list of atoms of which to find the smallest value.
+
 
+
==== Summation ====
+
 
+
Tokens: <code>SUM:</code>, <code>(</code>, <code>,</code>, <code>)</code>
+
 
+
Format: <code>SUM:([atoms])</code>
+
 
+
The value for <code>[atoms]</code> is a comma separated list of atoms to add together.
+
 
+
=== Modifications ===
+
 
+
Tokens: <code>D:</code> or <code>Modification:</code>
+
 
+
Format: <code>D:[modification_display_id]</code> or <code>D:?</code>
+
 
+
The value for the <code>[modification_display_id]</code> parameter should match the <code>ModificationDisplayID</code> in the <code>Modifications</code> table. If the current item being evaluated is a modification, the value returned will be true if the modification's display id matches. If the current item being evaluated is a product, the value returned will be true if the product has a modification attached to it where the modification's display id matches. The format <code>D:?</code> is the equivalent of asking if the current item being evaluated is a modification.
+
 
+
==== Modification Product ====
+
 
+
Tokens: <code>D:P:</code>, <code>D:P:D:</code>, <code>Modification:Product:</code> or <code>Modification:Product:Modification</code>
+
 
+
Format: <code>D:P:[product_display_id]</code> or <code>D:P:D:[modification_display_id]</code>
+
 
+
The value for the <code>[product_display_id]</code> parameter should match the <code>ProductDisplayID</code> in the <code>Products</code> table. The value returned will be true if the modification being evaluated is attached to a product with a matching display id. The format <code>D:P:D:[modification_display_id]</code> is the equivalent of asking if the modification that is being evaluated is attached to a product that with a matching modification display id.
+
 
+
==== Modification Product Tags ====
+
 
+
Tokens: <code>D:P:T:</code> or <code>Modification:Product:Tag:</code>
+
 
+
Format: <code>D:P:T:[tag_name]</code>
+
 
+
Used to determine if the modification is attached to a product that is tagged as the value specified in the <code>[tag_name]</code> parameter.
+
 
+
==== Modification Product Categories ====
+
 
+
Tokens: <code>D:P:C:</code> or <code>Modification:Product:Category:</code>
+
 
+
Format: <code>D:P:C:[product_category_display_id]</code>
+
 
+
Used to determine if the modification is attached to a product that is included in the category as specified by the value of the <code>[product_category_display_id]</code> parameter.
+
 
+
=== Nested Formulas ===
+
 
+
Tokens: <code>F:</code> or <code>Formula:</code>
+
 
+
Format: <code>F:[parameter]</code>
+
 
+
Executes the pricing rule with a name of <code>[parameter]</code>.  This is primarily used in conjunction with the conditional operators, or to split expressions into shorter pieces.
+
 
+
The value for <code>[parameter]</code> should match <code>PricingRuleLabel</code>.
+
 
+
=== Conditionals ===
+
 
+
Tokens: <code>EVERY:</code>, <code>I:</code>, <code>LIMIT:</code>, <code>SOME:</code>
+
 
+
==== Every Condition ====
+
 
+
Tokens: <code>EVERY:</code> or <code>ALL:</code>, <code>(</code>, <code>,</code>, <code>)</code>
+
 
+
Format: <code>EVERY:([atoms])</code>
+
 
+
The value for <code>[atoms]</code> is a comma separated list of atoms to test against. Returns true if all of the atoms test true.
+
 
+
==== Conditional Expressions ====
+
 
+
Tokens: <code>I:</code> or <code>Conditional:</code>, <code>=></code>, <code>,</code>
+
 
+
Format: <code>I:[conditional]=>[expression_if_true],[expression_if_false]</code>
+
 
+
Conditional expressions are defined using the above tokens.  When these tokens are found within the expression, the expression is split into multiple ''parts''.  The <code>[conditional]</code> parameter is ''always'' executed to determine if it evaluates to a <code>true</code> or <code>false</code> value.  If this evaluates to <code>true</code>, the <code>[expression_if_true]</code> parameter is executed.  If it evaluates to <code>false</code>, the <code>[expression_if_false]</code> parameter is executed.
+
 
+
==== Limits ====
+
 
+
Tokens: <code>LIMIT:</code>, <code>(</code>, <code>,</code>, <code>)</code>
+
 
+
Format: <code>LIMIT:([atoms])</code> or <code>LIMIT:[maximum]([atoms])</code>
+
 
+
The value for <code>[atoms]</code> is a comma separated list of atoms to test against. The value of <code>[maximum]</code> indicates the threshold at which the result will be true (greater than <code>[maximum]</code>). If no <code>[maximum]</code> is supplied, it is assumed <code>0</code>.
+
 
+
==== Some ====
+
 
+
Tokens: <code>SOME:</code> or <code>ANY:</code>, <code>(</code>, <code>,</code>, <code>)</code>
+
 
+
Format: <code>SOME:([atoms])</code>
+
 
+
The value for <code>[atoms]</code> is a comma separated list of atoms to test against. Returns true if any of the atoms test true.
+
 
+
=== Style Options ===
+
 
+
Tokens: <code>O:</code> or <code>StyleOption:</code>
+
 
+
Format: <code>O:[style_option_display_id]</code> or <code>O:[style_option_tag_name]</code>
+
 
+
The value for the <code>[style_option_display_id]</code> parameter should match the <code>StyleOptionDisplayID</code> in the <code>StyleOptions</code> table. The value of <code>[style_option_tag_name]</code> should match the <code>StyleOptionTag</code> in the <code>StyleOptionTags</code> table.
+
 
+
=== Products ===
+
 
+
Tokens: <code>P:</code> or <code>Product:</code>
+
 
+
Format: <code>P:[product_display_id]</code> or <code>P:?</code>
+
 
+
The value for the <code>[product_display_id]</code> parameter should match the <code>ProductDisplayID</code> in the <code>Products</code> table. The format <code>P:?</code> is the equivalent of asking if the current item being evaluated is a product.
+
 
+
==== Product Modifications ====
+
 
+
Tokens: <code>P:D:</code> or <code>Product:Modification:</code>
+
 
+
Format: <code>P:D:[modification_display_id]</code> or <code>P:D:?</code>
+
 
+
The value for the <code>[modification_display_id]</code> parameter should match the <code>ModificationDisplayID</code> in the <code>Modifications</code> table. The value returned will be true if the product being evaluated has a modification attached to it where the modification's display id matches. The format <code>P:D:?</code> is the equivalent of asking if the current product has any modifications attached to it.
+
 
+
==== Product Modification Categories ====
+
 
+
Tokens: <code>P:D:C:</code> or <code>Product:Modification:Category:</code>
+
 
+
Format: <code>P:D:C:[modification_category_display_id]</code>
+
 
+
The value for the <code>[modification_category_display_id]</code> parameter should match the <code>ModificationCategoryDisplayID</code> in the <code>ModificationCategories</code> table. Returns true of the product being evaluated has any modifications attached to it which match the specified modification category.
+
 
+
=== Variable Price Codes ===
+
 
+
Tokens: <code>M:</code> or <code>OEVariablePriceCode:</code>
+
 
+
Format: <code>M:[variable_code]</code>
+
 
+
Used to obtain the price for the current item.  The value specified for the <code>[variable_code]</code> parameter is used, alongside the current price group, to obtain the price for the current item.  The value for the <code>[variable_code]</code> parameter must match the <code>Code</code> column in the  <code>OEVariablePriceCodes</code> table.
+
 
+
=== Style Option Selections ===
+
 
+
Tokens: <code>Q:</code> or <code>StyleOptionSelection:</code>
+
 
+
Format: <code>Q:[style_option_display_id]</code> or <code>Q:[style_option_tag_name]</code>
+
 
+
The value for the <code>[style_option_display_id]</code> parameter should match the <code>StyleOptionDisplayID</code> in the <code>StyleOptions</code> table. The value of <code>[style_option_tag_name]</code> should match the <code>StyleOptionTag</code> in the <code>StyleOptionTags</code> table.
+
 
+
=== Prices ===
+
 
+
Tokens: <code>R:</code> or <code>Price:</code>
+
 
+
Format: <code>R:[price_type]</code> or <code>R:[pricing_rule_label]</code>
+
 
+
Used to obtain the price for the current item. Only four values are valid for the <code>[price_type]</code> parameter. These values are <code>BOOK</code>, <code>LIST</code>, <code>PREMIUM</code> or <code>BASE</code>. If <code>[pricing_rule_label]</code> is supplied, it executes the pricing rule with a name of <code>[pricing_rule_label]</code>. The value for <code>[pricing_rule_label]</code> should match <code>PricingRuleLabel</code>.
+
 
+
=== Tags ===
+
 
+
Tokens: <code>T:</code> or <code>Tag:</code>
+
 
+
Format: <code>T:[tag_name]</code>
+
 
+
Used to determine if the current item is tagged as the value specified in the <code>[tag_name]</code> parameter.
+
 
+
=== Upcharges ===
+
 
+
Tokens: <code>U:</code> or <code>Upcharge:</code>
+
 
+
Format: <code>U:[style_option_category_short_name]</code>
+
 
+
Used to obtain the price of an upcharge for the style option category that matches the <code>[style_option_category_short_name]</code> parameter for the current item.  The value for the <code>[style_option_category_short_name]</code> must match the <code>ShortName</code> column in the <code>StyleOptionCategories</code> table.
+
 
+
=== Variables ===
+
 
+
Tokens: <code>V:</code> or <code>Variable:</code>
+
 
+
Format: <code>V:[variable_code]</code>
+
 
+
Used to obtain the value of a product variable for the current item.  The value for the <code>[variable_code]</code> parameter must match the <code>VariableCode</code> column in the <code>OEVariables</code> table.
+
 
+
=== Modification Variables ===
+
 
+
Tokens: <code>W:</code> or <code>ModificationVariable:</code>
+
 
+
Format: <code>W:[variable_code]</code>
+
 
+
Used to obtain the value of a modification variable for the current item.  The value for the <code>[variable_code]</code> parameter must match the <code>VariableCode</code> column in the <code>OEVariables</code> table.
+
 
+
=== Constants ===
+
 
+
Tokens: <code>X:</code> or <code>Constant:</code>
+
 
+
Format: <code>X:[constant_name]</code>, <code>X:[decimal]</code>, <code>[decimal]</code>, <code>"[string]"</code> or <code>[boolean]</code>
+
 
+
Used to obtain the value of constant.  The value for the <code>[constant_name]</code> parameter must match the <code>ShortName</code> column in the <code>Constants</code> table. If <code>[decimal]</code> is used, the value must be a string representation of a number. <code>[string]</code> can be any valid string, wrapped in double quotes. <code>[boolean]</code> can be <code>true</code> or <code>false</code> (case-insensitive).
+

Latest revision as of 16:05, 29 June 2016

Test