Filter Rules

Filter rules are used to specify the products that a filter should contain. Rules can be combined to create tailored lists of products.

This article gives an overview of the various types of filter rules available.

Rules

Rules are used to search your stores database of products, to return a list that you can display to customers. You can combine multiple rules using AND/OR logic to create more complex and tailored lists. You can also use values in your rules that are aware of the currently viewed product.

Irrespective of the complexity, each rule will consist of three items:

  • Field
  • Operator
  • Value

For example:

  • One rule may search for products whose Price (Field) is Greater Than (Operator) £50.00 (Value).
  • Another rule may search for products whose Price (Field) is Less Than (Operator£60.00 (Value).
  • A third rule may search for products whose Stock (Field) is Greater Than (Operator1 (Value).

Combining these rules would result in products being returned that are both greater than £50 and less than £60, but also in stock.

  • A fourth rule may search for products whose Colour (Field) is Equal to (Operator) Current Products Colour (Value).

Combining the first three rules in a group, and then using an OR operator for the fourth rule would result in products being returned that are both greater than £50, less than £60, and in stock - as well as - all products that match the currently viewed products colour (irrespective of the price or stock).

We will walk through how to build this example in the next article, Filter Rules Example which will give you the foundation from which to build further, more complex rules.

Fields

There are 4 types of Fields that you can use to search for products:

  • Products: related to the products details (Stock, Price, etc)
  • Product Derived: related to the product sale status in Aurora (Best Sellers, On Sales, New in X Days, Recently Purchases)
  • Product Derived Basket: related to the product basket status (Viewed, In Basket, or Purchased)
  • Product Additional Fields: Any additional field created for products in your store.

🚧

Products: Price

All prices used are based on default pricing, price groups are not supported.

🚧

Products: Categories Dynamic

When the Products: Categories Dynamic field is used in conjunction with the {current.p.category} variable, its behaviour will depend on the categories assigned to the "current" product.

  • Parent category assigned. No child categories exist
    Returns all products that match the parent category only
  • No parent category assigned. Child categories assigned
    Returns products matching child categories only
  • Parent category assigned. Child categories assigned
    Returns products matching child categories only
  • Parent category assigned. Child categories not assignedReturns products that match the parent category only and have no child categories assigned.

Operators

The operators available will vary depending on the Field selected, though the generic options are listed here:

  • Equal
  • Not Equal
  • Greater
  • Greater or Equal
  • Less
  • Less or Equal
  • In
  • Not In
  • Any
  • All
  • Exact
  • Remove Duplication

👍

The ANY, ALL and EXACT operators should be used where the {current} variable is used in tandem with searches based on Product Additional Fields or the Categories Dynamic field.

Equal/Not Equal/Greater/Greater or Equal/Less/Less or Equal

When using these operators against additional fields, if there are multiple values for a field, the first value will be used.

Removing Duplicate Products

Using the remove duplicates operator, when selected for a particular field, all but one of the products that contain duplicate values for that field will be removed. Aurora will present only the first product found. This can be useful where you have a common value between many products, but you wish to only show one of them.

You can also select more than one field at a time, from which to prevent duplications. For example, you could remove duplicate products that have the same Product Style Code and/or Price.

🚧

If a filter uses the remove duplicates operator, all product lists that contains the filter will be affected by the field/operator combination, even if the other filters assigned do not use this operator.

Therefore, if the same product list contains various filters that each contain different remove duplicate operators, that product list will be affected by all of them.

For example, consider a single product list that contains several filters, where only one of the filters contains the remove duplicates operator for the Style Code field. In this situation, the whole product list will have products whose Style Code is duplicated removed.

🚧

The remove duplicates operator can only be used at the parent level - it cannot be nested in a group of rules.

IN/NOT IN

These operators are designed to only work with strings of data. You may provide a comma separated list of values. For example, "500, 400" or just a single value such as "Black".

ANY/ALL/EXACT

The ANY, ALL and EXACT operators are useful when searching fields that can contain several values per product. For example, a colour field could contain one colour for one product, and three colours for another product.

  • The ANY operator returns products that match any (at least one) of the values in the respective field for the current product.
  • The ALL operator only returns products that match all values in the respective field for the current product.
  • The EXACT operator only returns products that match the values in the respective field for the current product exactly.

🚧

Not quite seeing the results you expected?

  • The ALL operator will match products that contain "all" of the values of the current product (this does not exclude products that, as well as matching all values, also include further values).
  • If there is only one value for the field of the current product you are searching for, the ANY and ALL operators will return the same products. If you use a product that has more than one value for the field in question, the results between ANY and ALL will be different.

ANY/ALL Working Example 

To illustrate the use of the ANY and ALL operators, assume we have a store that contains the below five products:

Product #Colour FieldCategory
1GreenMain Category
2Blue
Red
Main Category
Sub Category 1
3Green
Blue
Red
Sub Category 1
Sub Category 2
Sub Category 3
4Green
Blue
Main Category
Sub Category 2
Sub Category 3
5Green
Red
Sub Category 1
Sub Category 3

Using the above products as a basis, we have five example rules below, with the products that will be returned.

RuleProducts Returned
Product Additional Field: Colour
ANY
{current.p_add.colours}
(Current Product: 1)
Returns any product which has a colour of Green.

3, 4 and 5
Product Additional Field: Colour
ALL
{current.p_add.colours}
(Current Product: 2)
Returns only products which have a colour of Blue and Red.

3
Product Additional Field: Colour
ALL
{current.p_add.colours}
(Current Product: 3)
Returns only products which have a colour of Green, Blue and Red.

No products returned
Products: Categories Dynamic
ANY
{current.p.category}
(Current Product: 4)
Returns any products with a subcategory of 2 or 3.

3 and 5
Products: Categories Dynamic
ALL
{current.p.category}
(Current Product: 5)
Returns only products with a subcategory of 1 and 3.

3

These same principles can be applied to a store that contains a large number of products.

EXACT Working Example

As none of the example products above share fields or categories exactly, none would return products using EXACT. Let's assume we have a store with the below products:

Product #Colour Field
1Red
2Red
Green
3Red
Green
Blue
4Green
Blue
5Blue
6Red
Green
7Blue
Green
Red

Using the above products as a basis, we have these example EXACT rules below, with the products that will be returned for each.

RuleProducts Returned
Product Additional Field: Colour
EXACT
{current.p_add.colours}
(Current Product: 1)
Returns products which have a colour of exactly Red, and only red.

No products returned
Product Additional Field: Colour
EXACT
{current.p_add.colours}
(Current Product: 2)
Returns products which have colours of exactly Red and Green only.

6
Product Additional Field: Colour
EXACT
{current.p_add.colours}
(Current Product: 3)
Returns products which have colours of exactly Red, Green and Blue only.

7

Note that the order the values are saved in is not important.
Product Additional Field: Colour
EXACT
{current.p_add.colours}
(Current Product: 4)
Returns products which have a colour of exactly Green and Blue only.

No products returned
Product Additional Field: Colour
EXACT
{current.p_add.colours}
(Current Product: 5)
Returns products which have a colour of exactly Blue only.

No products returned
Product Additional Field: Colour
EXACT
{current.p_add.colours}
(Current Product: 6)
Returns products which have colours of exactly Red and Green only.

2
Product Additional Field: Colour
EXACT
{current.p_add.colours}
(Current Product: 7)
Returns products which have colours of exactly Blue, Green and Red only.

3

Note that the order the values are saved in is not important.

Values

There are two kinds of values:

  • Static: numbers, text, date, etc. E.g: "10", "ABC" or "2015-01-10"
  • Dynamic Values: variables that are invoked using the { character. Once the { character is entered into the value field of a rule, a list of all available dynamic variables is listed.

There are 3 types of dynamic values:

  • Context
  • Current
  • Functions

Context

These variables apply to the same product that is being queried. For example, you could build a rule that searches for products whose Price is Greater Than or Equal to its own (the searched for products) RRP Price. Examples of use include:

  • Give me products where their price is less than its RRP
  • Give me products where their length is less than their width
{context.p.price_rrp}  

In this example, the rule will generate a list of products where the Product Price is Greater than or Equal to its own Product Price RRP. Any product that matches this rule will be returned. Please see an example here.

🚧

All prices used are based on default pricing, price groups are not supported.

Current

These variables apply to the product being currently viewed. For example, you could build a rule that searches for products whose Price is Equal to the Price of the product being viewed.

{current.p.price_rrp}  

In this example, the rule will generate a list of products where the Product Price is Equal to Product Price of the product being viewed. Any product that matches this rule will be returned. Please see an example here.

🚧

All prices used are based on default pricing, price groups are not supported.

Functions

Functions allow you to perform a calculation that is evaluated when the product list is generated. There are currently 2 functions available:

  • Create Date - Creates a date that is X number of days from the current date. (X can be positive or negative). This function should only be used with fields that require a date value. 
    {function.createDate(X)}

  • Back in Stock - Searches for products that are now back in stock from the last X days. (Y = number of restocks to ignore. Default is >1). This function can only be used with the "Products: ID" field and the "in" operator.
    {function.backInStock(X,Y)} 

See an example usage of the Create Date function:

{function.createDate(X)}  

In this example, the rule will generate a list of products where the Products Date First Published is Less than or Equal to (Today's date + 10 days). Any products that match this rule will be returned.

Preview

Once a rule, or combination of rules have been added, you can preview the results of the filter using the Preview button.

👍

Take care when adding multiple rules. Each rule applied will likely further reduce the number of products being returned by the filter. Use the Preview button regularly to preview the results of the your filter each time a new rule is added.

Once clicked, a preview section will appear below your list of rules, listing the products that meet your specified criteria. If you make further changes to rules, you can click the Preview button again to refresh the preview.

You can also download a CSV file of the products returned by the preview using the CSV icon. 

🚧

Please note that only live products will be displayed in the preview, or used in product lists and their filters.