Custom sort
Create, test, and link scoring rule or code score profiles for category showcase sorting.
The Custom sort screen is where you manage score rule profiles that determine the order in which products appear in the showcase on category pages. Each profile consists of rules that assign points to products (or code that calculates the score) and the categories linked to the profile. For example, if you want products of a certain brand or with a specific attribute to be treated differently in sorting, you add points to these products with rules. It is intended for catalog and e-commerce teams.
Accessing the screen
Follow the menu path CMS – Headless Content › Custom sort. If you do not see it in the menu, your account does not have permission for this screen.
The New profile, edit, and delete buttons appear only for accounts authorized to modify sort profiles. If you lack permission, only the View (eye) icon appears on rows, and the profile opens read-only.
Screen sections
- Page title Custom sort, with the description "Score rule profiles for category showcase sorting." below; on the right, Export to Excel and New profile buttons.
- Filter area: Search box and filters opened via Detailed filters; below, Clear and Filter buttons.
- Profile list: above it, Per page selector, Filter result: … records counter, refresh icon, and Columns menu; below, pagination.
- When opening a profile, a large window appears: name and description, Score rule, and Linked categories sections.
Filtering and searching
| Field | Purpose | Tip |
|---|---|---|
| Search | Searches text in profile name, description, code text, created by, modified by, and rule field/value information. | Placeholder text: "Profile name, description or rule". Case insensitive; partial text is sufficient. |
| Predefined | Distinguishes predefined (system) profiles from added ones. | All, Yes, or No. Visible by default in the filter area. |
| Created by | Retrieves profiles created by a specific person. | Options come from creators of existing profiles. Opened via Detailed filters menu. |
| Modified by | Retrieves profiles last modified by a specific person. | Options come from existing profiles. Opened via Detailed filters menu. |
Filters apply when you press the Filter button (or Enter while in a field). Closing a filter from the Detailed filters menu clears its value. Clear empties all filters and search.
List
| Column | Meaning |
|---|---|
| Identity | Profile number. Hidden by default. |
| Profile | Profile name; description shown below in smaller text. This column cannot be hidden. |
| Description | Profile description as a separate column. Hidden by default (description already visible under the name). |
| Predefined | Blue Yes if the profile is predefined, gray No if not. Predefined profiles cannot be edited or deleted. |
| Score rule | How the profile scores: green Scoring · … rules, yellow Code, or pale No rules (see Statuses). |
| Created | Creation date and time; creator below. |
| Updated | Last update date and time; modifier below. |
| Created by / Modified by | Shows persons in separate columns. Hidden by default. |
| Icons at row end | Editable profiles show Edit (pencil) and Delete (trash); predefined profiles or without permission show only View (eye). |
All columns can be sorted by clicking the header; clicking again reverses the order. Rows with empty values (e.g., profiles without description) appear last regardless of sort direction. Sorting by Score rule groups code profiles together and orders scoring profiles by number of rules. If no column is selected, no additional sorting is applied; profiles list in source order. Hidden columns can be shown via the Columns menu; your choice is remembered by your browser. Page size can be 25, 50, or 100; default is 25. Empty values display as "—".
Actions
Creating a new profile
- Press the New profile button. The New sort profile window opens.
- Enter a name in the Profile field (required). Optionally add a Description.
- In the Score rule section, select either Scoring or Code mode and define the rules (details below).
- In the Linked categories section, add categories where the profile applies or leave empty.
- Press Save.
If successful, a "Saved" notification appears, the window closes, and the list refreshes. On error, a red "Something went wrong" notification with explanation appears and the window stays open. Cancel closes without saving; no confirmation is asked.
Save is disabled if: the Profile field is empty (shows "Name required" below), code mode has empty code, or the profile’s categories are still loading.
Editing a profile
- Click the Edit (pencil) icon on the row. The Edit sort profile window opens with the profile’s saved name, description, rules, and categories.
- Make necessary changes and press Save.
Categories, rules, and code are saved only when you press Save; closing the window discards changes.
Caution when switching modes: switching between Scoring and Code and saving deletes the other mode’s content without confirmation (see Score rule). Switching modes within the window without saving does not delete anything.
Viewing a predefined profile
Predefined profiles and profiles without edit permission open read-only.
- Click the View (eye) icon on the row. The Sort profile window opens.
- Predefined profiles show a warning "Predefined profiles cannot be edited." at the top. Fields are locked, mode cannot be changed; no buttons to add/remove rules or categories.
- If the profile is in Code mode, you can still test the code: enter a product code in the Sample product field and press Fetch, then Run with sample product. The sample product does not load automatically in read-only mode.
- Exit with Close.
Deleting a profile
- Click the Delete (trash) icon on the row. This icon does not appear for predefined profiles.
- Read the warning "The “…” profile will be deleted. This action cannot be undone."
- Confirm with red Delete or exit with Cancel.
If successful, a "Deleted" notification appears and the list refreshes. Deleted profiles cannot be restored. To see which categories a profile is linked to before deleting, open the profile and check the Linked categories section.
Exporting to Excel
- Press the Export to Excel button. While preparing, the button shows Preparing…
- The file downloads to your browser and a "Excel file downloaded" notification appears. The file name includes the current date (
ozel-siralama-<date>.xlsx).
The file contains all profiles regardless of filters, search, or sorting on screen. Columns: Id, Predefined, Name, Description, Score Rule, Created By, Modified By, Created On, Modified On. The Score Rule column contains the stored rule (scoring rules or code text); linked categories are not included. Import from Excel is not supported on this screen.
Score rule
In the profile window, you select one of two modes with buttons on the right of the Score rule section. Only the selected mode is saved: saving in Code mode deletes scoring rows, saving in Scoring mode deletes code.
Scoring mode
Assign points without coding using the rule table. As described above: each rule tests a product field with a condition and adds points to matching products.
| Column | Description |
|---|---|
| Field | Product field to test. Suggestions appear as you type; you can also enter a field name not in the list. |
| Selector | If the field has multiple values, which one to test. Suggestions: Any, First, Last. Can be left empty. |
| Operator | Comparison type. Suggestions: =, !=, >, <, contains. New rows default to =. The field accepts free text and is not validated; choosing from suggestions is safest. |
| Value | Value to compare the field against. |
| Score | Number added to the product if the condition is met. |
| Actions | Remove rule (trash) deletes the row. |
Steps:
- Press Add rule; a blank row is added.
- Fill in Field, optionally Selector, Operator, Value, and Score.
- Repeat steps 1–2 for more rules.
Rows with empty Field or empty/zero Score are ignored on save. If any row lacks a score, a warning appears below the table: "… rows have no score; these rows will be ignored on save." If no rows exist, it says "No rules yet." If all rows are ignored, the profile still saves and appears as Scoring · 0 rules in the list.
Code mode
Used to calculate the score with JavaScript code. The product is available as the parameters object; the value of the last expression in the code is the score.
The window has a JavaScript code editor on the left and a Sample product field on the right.
- The editor shows line numbers and syntax highlighting. Typing
parameters.shows suggestions of sample product fields; methods likelength,find,filterare also suggested. - Syntax errors are marked next to the line as Syntax error.
- If code is empty, a message "Code cannot be empty in code mode" appears below and Save is disabled.
To test code without saving:
- Enter a product code in the Sample product field and press Fetch (or Enter). If empty, a general sample product is fetched. When switching to code mode in an editable profile, a sample product loads once automatically.
- The product’s fields display on the right. If no product is found for the code, "Product not found." appears.
- Press Run with sample product. While running, the button shows Running…
- The result appears below the button under the Result heading. If the code errors, the error message appears under Run error; if it exceeds 3 seconds, "Timeout (3 sec); code stopped." is shown.
Test runs do not save anything. As noted next to the button, code runs in an isolated frame without network access and with a 3-second limit. If no product is found, the code runs with an empty parameters object.
When the suggestion list is open, pressing Esc closes only the list. When the list is closed, pressing Esc closes the window and unsaved code is lost.
Linked categories
Determines in which categories the profile applies. If no categories are added, the section shows "No categories means all categories."
To add categories:
- Press Add category. The selection area opens.
- Choose a tree from the Category tree list (Select a tree).
- Optionally enter part of a category name or path in Search category.
- Select a category from the Category list. The list shows up to 200 matches and excludes already added categories; narrow your search if you don’t see what you want.
- Press Add. The category is added to the table with Identity and Category (full path) info. Repeat steps 3–5 for more categories.
- Close the selection area with Close when done.
To remove a category, click the Remove category (trash) icon on its row. Additions and removals take effect only after saving the profile with Save.
Form fields
| Field | Required | Description / rule |
|---|---|---|
| Profile | Yes | Profile name; max 200 characters. Leading and trailing spaces are trimmed. Shows "Name required" below if empty. |
| Description | No | Max 1000 characters. Visible under the name in the list. |
| Score rule | Mode always selected | Scoring or Code; new profiles default to Scoring. Up to 500 rules allowed in scoring; rules are optional. Code mode requires non-empty code; max 100,000 characters. |
| Linked categories | No | Up to 2000 categories. Empty list means all categories. |
Statuses
| Status (on screen text) | Meaning | Next step |
|---|---|---|
| Scoring · … rules (green) | Profile scores with rule table; number is count of saved rules. Scoring · 0 rules means no valid rules. | Open profile to view or edit rules. |
| Code (yellow) | Profile calculates score with JavaScript code. | Test after editing code with Run with sample product. |
| No rules | No score rule saved in profile. | Open profile to add rules or delete if unused. |
| Predefined: Yes | System-provided profile; cannot be edited or deleted. | Create a new profile if similar editing is needed. |
Common situations
- Some rules I saved disappeared. Rows with empty or zero Score and empty Field are not saved. Assign a nonzero score to each rule.
- I switched to code mode and saved; my old rules are gone. Only the selected mode is saved. To return to scoring, re-enter the rules.
- I cannot edit a predefined profile. Predefined profiles are read-only. Create and edit a new profile instead.
- The category I search for does not appear in the list. First select the correct Category tree; the list shows up to 200 results, so narrow the search with Search category. Already added categories do not appear.
- Code test says "Timeout". The code did not produce a result in 3 seconds; it may have an infinite loop or heavy operation. Simplify and retry.
- No options in Created by / Modified by filters. Options populate after the list loads all profiles. If you opened the menu before loading, close and reopen it.
- Errors like "Profile not found" or "Predefined profiles cannot be changed" when saving or deleting. The profile may have been deleted or changed by someone else while you had it open. Refresh the list and reopen the profile.