A single pricing or promotion rule: a set of match criteria (user, group, organisation, org type, vendor org type, product, category, brand, quantity and total sale ranges, and custom fields) together with an optional promotion name and an adjustment to apply when a purchase matches it - a fixed value, an added value, a multiplier, or an mvel expression. Rules for a store are stored as rows in a CSV file and matched against a purchase by PricingRulesService.findMatching; the most specific matching tier rule (no promotion name) and the most specific matching promotional rule are both applied when calculating a final price.
Properties
| Property | Returns | Description |
|---|---|---|
| addValue | BigDecimal | An amount to add to the price when this rule is applied (or subtract, if negative). Applied after any fixed value and before any multiplier. |
| baseProductCode | String | The product or sku code, or a delimited list of codes, this rule is restricted to. A code prefixed with "!" excludes that product instead of matching it. Null or blank means the rule is not restricted by product. |
| blank | boolean | Returns true if none of this rule's match criteria or output adjustments are set, meaning it is an empty, no-op rule row that would match everything and change nothing. |
| brandName | String | The product brand name this rule is restricted to. Null or blank means the rule is not restricted by brand. |
| categoryName | String | The product category code, or a delimited list of category codes, this rule is restricted to. A code prefixed with "!" excludes that category instead of matching it. Null or blank means the rule is not restricted by category. |
| customFields | String | A semicolon-separated list of custom field name/value pairs this rule requires to match. A pair with a blank value means the custom field must be present, without requiring a specific value. |
| fixedValue | BigDecimal | A fixed price that replaces the sku's list price when this rule is applied, before any add value or multiplier. |
| groupName | String | The group name, or a delimited list of group names, this rule is restricted to. Null or blank means the rule is not restricted by group membership. |
| maxQuantity | BigDecimal | The maximum purchase quantity this rule requires to match. |
| maxTotalSale | BigDecimal | The maximum running total sale value this rule requires to match. |
| minQuantity | BigDecimal | The minimum purchase quantity this rule requires to match. |
| minTotalSale | BigDecimal | The minimum running total sale value this rule requires to match. |
| multValue | BigDecimal | A multiplier applied to the price when this rule is applied, after any fixed and add values. |
| mvelExpression | String | An mvel expression used to calculate the final price, evaluated after any add value and multiplier have been applied. When set, its result overrides the price calculated from fixedValue/addValue/multValue. |
| notes | String | Free-text notes about this rule, for internal reference only - not used when matching or pricing. |
| orgId | String | The organisation id, or a delimited list of organisation ids, this rule is restricted to. Null or blank means the rule is not restricted by organisation. |
| orgType | String | The customer organisation type, or a delimited list of organisation types, this rule is restricted to. Null or blank means the rule is not restricted by organisation type. |
| promotionName | String | Name of the promotion this rule is tied to. If set, this rule is a promotional rule that is matched against the purchaser's currently activated promotions rather than a plain tier rule. |
| specifity | int | A score reflecting how many match criteria are set on this rule, used to pick the more specific of two otherwise-matching rules (for example, when both a general tier rule and a more targeted one match the same purchase). |
| userId | String | The user id, or a delimited list of user ids, this rule is restricted to. Null or blank means the rule is not restricted by user. |
| vendorOrgType | String | The vendor organisation type this rule is restricted to, used for reseller pricing where the price depends on which reseller organisation type is selling the product. Null or blank means the rule is not restricted by vendor org type. |
Methods
isBlank() · getPromotionName() · getUserId() · getGroupName() · getOrgId() · getOrgType() · getMvelExpression() · getAddValue() · getMultValue() · getNotes() · getBaseProductCode() · getVendorOrgType() · getMinQuantity() · getMaxQuantity() · getMinTotalSale() · getMaxTotalSale() · getCategoryName() · getBrandName() · getCustomFields() · getFixedValue() · getSpecifity()
isBlank()
Returns: boolean
Returns true if none of this rule's match criteria or output adjustments are set, meaning it is an empty, no-op rule row that would match everything and change nothing.
getPromotionName()
Returns: String
Name of the promotion this rule is tied to. If set, this rule is a promotional rule that is matched against the purchaser's currently activated promotions rather than a plain tier rule.
getUserId()
Returns: String
The user id, or a delimited list of user ids, this rule is restricted to. Null or blank means the rule is not restricted by user.
getGroupName()
Returns: String
The group name, or a delimited list of group names, this rule is restricted to. Null or blank means the rule is not restricted by group membership.
getOrgId()
Returns: String
The organisation id, or a delimited list of organisation ids, this rule is restricted to. Null or blank means the rule is not restricted by organisation.
getOrgType()
Returns: String
The customer organisation type, or a delimited list of organisation types, this rule is restricted to. Null or blank means the rule is not restricted by organisation type.
getMvelExpression()
Returns: String
An mvel expression used to calculate the final price, evaluated after any add value and multiplier have been applied. When set, its result overrides the price calculated from fixedValue/addValue/multValue.
getAddValue()
Returns: BigDecimal
An amount to add to the price when this rule is applied (or subtract, if negative). Applied after any fixed value and before any multiplier.
getMultValue()
Returns: BigDecimal
A multiplier applied to the price when this rule is applied, after any fixed and add values.
getNotes()
Returns: String
Free-text notes about this rule, for internal reference only - not used when matching or pricing.
getBaseProductCode()
Returns: String
The product or sku code, or a delimited list of codes, this rule is restricted to. A code prefixed with "!" excludes that product instead of matching it. Null or blank means the rule is not restricted by product.
getVendorOrgType()
Returns: String
The vendor organisation type this rule is restricted to, used for reseller pricing where the price depends on which reseller organisation type is selling the product. Null or blank means the rule is not restricted by vendor org type.
getMinQuantity()
Returns: BigDecimal
The minimum purchase quantity this rule requires to match.
getMaxQuantity()
Returns: BigDecimal
The maximum purchase quantity this rule requires to match.
getMinTotalSale()
Returns: BigDecimal
The minimum running total sale value this rule requires to match.
getMaxTotalSale()
Returns: BigDecimal
The maximum running total sale value this rule requires to match.
getCategoryName()
Returns: String
The product category code, or a delimited list of category codes, this rule is restricted to. A code prefixed with "!" excludes that category instead of matching it. Null or blank means the rule is not restricted by category.
getBrandName()
Returns: String
The product brand name this rule is restricted to. Null or blank means the rule is not restricted by brand.
getCustomFields()
Returns: String
A semicolon-separated list of custom field name/value pairs this rule requires to match. A pair with a blank value means the custom field must be present, without requiring a specific value.
getFixedValue()
Returns: BigDecimal
A fixed price that replaces the sku's list price when this rule is applied, before any add value or multiplier.
getSpecifity()
Returns: int
A score reflecting how many match criteria are set on this rule, used to pick the more specific of two otherwise-matching rules (for example, when both a general tier rule and a more targeted one match the same purchase).