Skip to content

Working with Product Sorting

The sort order of products in Apptus eSales can be based on a variety of things. By default, the sort order of a product list is by relevance according to eSales, relevance. The sort_by argument can be included in a panel query to specify another sort order.

The type of sorting used should be aligned with the purpose of the panel used. An example of this is a panel that showcases new products. A relevant sorting for this panel can be based on a product attribute with the release date in descending order.

Sorting modifiers

Sorting modifiers asc and desc can be included in a sort_by argument to sort the data ascending or descending. If a sorting modifier is not included in an argument, the default modifier of the sorting type will be used.

It is not recommended to use a sorting modifier when sorting by relevance, personal, sales, or clicks. These sort orders default to desc. Using asc as a sorting modifier with these sort orders may produce unexpected results.

Sort by relevance

The sort order relevance is the default sorting type if the sort_by argument is not included in a panel query. Relevance of a specific product is based on context and will differ based on what panel or search phrase is used.

The relevance is calculated by eSales using parameters such as product information, strategy score, and customer history.

The default sorting modifier for relevance is desc. It is not recommended to include a sorting modifier when sorting by relevance.

Example arguments

sort_by: relevance

Sort by product attribute

Any product attribute can be used for sorting of products if a sort attribute has been configured for it. This attribute is then used in the argument sort_by.

The default sorting modifier for a product attribute is asc. It is recommended to include a sorting modifier when sorting by a product attribute.

Example arguments

sort_by: release_date desc
sort_by: price asc

Sort by personal

The personal sort order tries to find products that can be associated to a visitor based on the visitors previous actions, such as viewing or purchasing products. The personal sort is strictly personalised and does not take anything else in account. For example, if personal sort is used with a search panel, the match quality is not considered for the sorting.

The intended use of personal sort is for category or other landing pages. On these pages broad queries span large sets of products and match quality is either evident or meaningless. The personal sort brings personalised content to the top and backfills with the current best-selling products.

The default sorting modifier for personal is desc. It is not recommended to include a sorting modifier when sorting by personal.

Example arguments

sort_by: personal

Sort by sales

The sales sort order sorts products according to their strategy score.

The optimal period of time for the strategy score is automatically and individually chosen per product. This enables statistically significant trends to be recognized, and adequately compare products with a steady purchase rate to those that have quick changes in popularity.

The default sorting modifier for sales is desc. It is not recommended to include a sorting modifier when sorting by sales.

Example arguments

sort_by: sales

Sort by clicks

The clicks sort order sorts products according to popularity based on recent clicks. This type of sorting is useful when products cannot be purchased, such as for sites where accessories are sold for devices, but not the actual device itself. Sorting with clicks can be used as a good alternative for sites with low traffic as clicks are more frequent than purchases.

The default sorting modifier for clicks is desc. It is not recommended to include a sorting modifier when sorting by clicks.

Example arguments

sort_by: clicks

Sort by arithmetics

Custom sort orders can be created with arithmetics, using operators with sorting types. Normal execution precedence is applied but can be overridden with parentheses. It is also possible to use floating point literals.

It is not recommended to use the relevance sorting type in arithmetic expressions.

The default sorting modifier for a custom sort order is asc. It is recommended to include a sorting modifier when sorting by custom order.

Operations

The following operators are allowed when creating custom sort orders.

Sign Operator Example Description
+ Addition a+b Binary addition of the terms a and b.
- Subtraction a-b Binary subtraction of the terms a and b.
- Negation -a Unary negation of the term a.
* Multiplication a*b Binary multiplication of the terms a and b.
/ Division a/b Binary division of the terms a and b.
^ Exponentiation a^n The term a raised to the power of n.
~ Round ~a Unary round of the term a to the closest integer.
% Modulo a%b Binary module operation of the terms a and b.

Example arguments

sort_by: (avg_rating * rating_count + 300) / (rating_count + 100) desc

Multi-level sorting

Additional sorting levels can be used when sorting products. This is useful when there is a likelihood of multiple products having the same primary rank.

The levels of sort orders are separated by a comma, ,, in the sort_by argument and are listed in priority order.

Example arguments

sort_by: in_stock desc, relevance
sort_by: price desc, title asc
sort_by: price asc, sales desc

Sort by category rank

Products can be sorted based on their rank in a category with the category_key sort. A product can have one rank in a category and another rank in another category and as such can be sorted differently.

To sort a product by category rank, information about the category sort attribute together with key and rank per category must be present in the product data. The category sort attribute does not have to correspond to product categories.

The category_key sort uses the category sort attribute from the product data followed by the category key and a sorting modifier.

Example arguments

sort_by: category_key('category_rank_values,accessories') asc

Sorting recommendations

Following is a recommendation of when different sort orders are appropriate.

Sort order Modifier Pros Cons Usage example
Any product attribute Attribute dependent Sort order can be customized. No personalisation
Cannot adjust for current trends
Alphabetically ordered lists
Lists ordered by price or release date
relevance None Sort order adjusts to trends. Search results
personal None Sort order is trend adjusted and personalised. Category pages
sales None Good when popularity is essential. No personalisation What's hot-lists
clicks None Good when popularity is essential and the site is heavily relying on off-line purchases. No personalisation What's hot-lists
Low traffic sites

Refinements

Refinements can be set for sort attributes to enable normalisation of product attributes before sorting. The most common usage of refining is to normalise text to lower case or to remove all non-digit characters before sorting by price. The following refinement settings are available:

  • (no refinement) - No normalisation is performed
  • Case insensitive - Normalisation to lower case
  • Keep digits and letters (e.g. Text123) - Removes all characters that are neither letters or digits, including spaces
  • Keep digits and letters, case insensitive - Removes all characters that are neither letters or digits, including spaces, and normalises letters to lower case
  • Keep digits only (e.g. 1234) - Removes all characters that are not digits
×