Live search addon for cs-cart

Live search add-on

Add-on page in the store: Live Search with Search History · Changelog

Live search add-on

A powerful and functional set of search tools for your website. It is a worthy alternative to cloud-based site search services, while having unique functionality.

Key features of the add-on:

  • Search for products, brands, categories, text pages and sellers (for multivendor edition) on your website;
  • Browse  products by category directly in the search popup block;
  • Keyboard navigation through the search results;
  • Settings of the fields for which you want to search;
  • Correction of spelling errors or phrases using the built-in Yandex Speller service;
  • Select of two pre-installed themes with the ability to change the color scheme of each of them;
  • Maintaining search history with the ability to view in 4 slices:
    - by requests
    - by search phrases
    - by cliecked products
    - by users
  • Last user queuries can be displayed on search window;
  • "Synonyms" functionality;
  • "Stop Words" functionality;
  • "Search motivation" functionality;
  • Search phrases management;
  • Search speed-up for large catalogs: the add-on's own search index and a full-text database index;
  • Filters in the search window by price, brand and category, sorting of the found products and a "list / grid" view;
  • Voice input of the query;
  • A limit on the number of search requests from one address;
  • Built-in Redis based Turbo cache for search queries.
Compatibility

The add-on is compatible with the entire cs-cart 4.x branch with such editions as CS-Cart, CS-Cart Ultimate, Multivendor, Multivendor Plus, Multivendor Ultimate. At the moment there is no information about the complete incompatibility with any theme. If an add-on conflicts with your theme, please contact via our Help Center.

We have made additional special compatibility with third part developer addon to have possibility to search on their fields:

  • AB: custom H1 addon
  • AB: SEO filters addon

The add-on is incompatible with any other search add-on.

The extreme search speed-up mode needs MySQL 5.6 or newer, or MariaDB; the search runs at full speed on MySQL 8.0.20 and newer.

Add-on installation

After success payment, your order will be automatically marked as Paid within a few minutes. Once order changed to Paid status - add-on License activation passed success and you will received an e-mail with confirmation the receipt of payment and a second e-mail with a  download add-on link. You can also download the add-on in our License Management section of our website. To install the add-on on your website, please follow these steps:

  1. Download the latest version of the add-on on our website in the "License Management" section or via the link sent by e-mail.
  2. Go to Add-ons → Manage Add-ons and in the gear button, select Manual Installation.
  3. Select the downloaded file and complete the installation of the add-on.

Add-on installation is completed. To go to the add-on settings page, select the installed add-on in the top menu Add-ons → CS-Commerce add-on

Settings

After add-on installation, its settings are set to default values. To access the add-on settings in the admin panel, go to the Add-ons → CS-Commerce add-ons section and select installed add-on from the drop-down list.

General settings

Setup search objects

Main settings tab of the add-on allows you to select search objects and set display limits. There are several settings that we want to focus on:

  • "Display out of stock products on end of the list" - Enabling this option will force Display out of stock products on end of the list independent of selection sorting.
  • "Automatically increase the search popularity of a product" - This option allows you to automatically increase the rank of a product to a specific search query. The more users click on a product from a specific search phrase, the higher this product will be displayed for this search phrase. This option works only for sorting "By relevance based on popularity"
  • "Show search based categories filter" - Select this option to display categories filter block directly in the search window. User can filter by several categories at once.
  • "Suggest corrections" - Enable this option to suggest corrections of typos, incorrect layout, etc. Powered by Yandex Speller service.
  • Show the user their search history - enable this option to display user their own last search queries. 

Product search settings

In this section of settings, you can select the fields by which the search will be carried out. Check the boxes you want to search for. If you mark the search by features, you will be asked to select specific features by which you want to search.

Additional search fields are placed in a separate group. Search will not work on them if you enable the "Search Accelerator" function.

Tip: Check only the required fields for your search. Select only those search ауфегкуы that contain information useful to the buyer. The fewer fields for search are marked, the less the load on the server and, as a result, the search results are displayed faster.

The "Extra settings" group allows you:

  • set the minimum number of characters to start searching for products;
  • enable automatic redirection to the product page if only one product was found;
  • block the user's redirection to the search results page by pressing the "Enter" button.  

Supported search fields:

  • Product Name, description and short description;
  • Product Code and Product ID;
  • Search keywords;
  • Product features and options;
  • Meta title, Meta description, Meta keywords;
  • Product tags.

 Multivendor settings

For Multivendor, Multivendor PLUS and Multivendor ULTIMATE editions, an additional settings tab will be displayed. It collects settings that are relevant only for these editions. You can enable the search by seller stores and set a limit to display. You can also set access rights to the history of product search for vendors.

Filters in the search window

The found products can be narrowed down right in the live search window. On a desktop the filters sit in the sidebar, on a phone they are behind the Filters button. Each filter is switched on separately on the General settings tab, in the Setup search objects group; all three are on by default and are available when the product search is enabled.

  • Show search based categories filter — the categories in which products were found; several can be selected.
  • Price filter — a price range: the "from" and "to" fields and a slider. Switched off, it costs the search nothing.
  • Brand filter — brands of the found products with counts. It uses the feature chosen in the Search brands setting; without it the filter is not shown and makes no queries.

Request limit

The Extra settings group of the Product search settings tab sets a limit on live search requests from one address: Requests allowed from one address (180 by default) within Period for counting requests, seconds (60 by default). Requests over the limit are refused until the period ends with a 429 response, so a script calling the search over and over does not load the store database. A visitor typing a query makes one request per typed character and never reaches the limit. 0 switches the limit off.

If the store runs behind a proxy or a CDN, the visitor address passed by the proxy is counted. Requests from the server itself and from the local network are not counted.

Appearance settings

The add-on has a built-in styles editor with a preview of the search results block. Admin is offered several themes for displaying the search window (Modern and Classic), and it is also possible to change the color palette of the selected theme. In addition, in this section of settings, the administrator can show or hide individual elements of the search window, such as:

  • The price of the product
  • Product code
  • Add to cart button
  • Add to favorites button
  • Add to Compare List button
  • Quick View button

Product list view and sorting

Above the found products the search window shows a "list / grid" view switch and a sort selector. They are set up in the Product list view block:

  • List view available and Grid view available — which views a visitor can choose.
  • Default view — the view shown to a visitor who has not switched it yet. If this view is disabled, the first enabled one is used. The switch is only shown on a desktop: on a phone the list is always used.
  • Show sort selector — a sort menu above the found products: by relevance, cheapest first, most expensive first, newest first, oldest first, by name, by popularity. The order selected at first is set by the Sorting setting on the general settings tab; the same setting defines how relevance is calculated.

Voice search

The Voice search setting adds a microphone button to the search field: the spoken phrase becomes the query. The button is shown only in browsers with speech recognition (Chrome, Edge, Safari).

Search history

This section is intended for the analysis of search queries and the analysis of user preferences. The search history is presented in four groups:

  1. All search queries with user information, selected language and timestamp.
  2. By search phrases. This section contains all search phrases, displaying information about the number of requests for a search phrase and the number of clicks on products.
  3. By product. A list of products will be displayed, to which customers moved from the search with clicks info on each of the products, and what search phrases were used to find this product.
  4. User search history. Allows you to see the search history for specific user, if the user was logged in.

Synonyms management

For search phrases or parts of them, you can set synonyms. Sometimes, the same products can have different names due to language dialects or word abbreviations. For example, on a website you sell laptops, and some customers type in "workstation". In order for the buyer to finally see the Laptops, you need to add a synonym for the search phrase "Workstation". You can set an unlimited number of synonyms for one search phrase.

Tip: Use only relevant synonyms. Otherwise, in the search results, the buyer will not see what he is really looking for.

A synonym group consists of a phrase and its synonyms. The phrase is the reference value that is actually searched for in the database. Synonyms are what a customer may type instead: colloquial and regional names, abbreviations, typos. A synonym query expands only into the phrase of its group: if the phrase "Laptop" has the synonym "workstation", then for the query "workstation" the add-on also searches for "laptop". The query is not expanded the other way round or into the other synonyms of the group — this keeps extra products out of the results and the search fast.

Synonyms can be added using the admin panel interface, as well as through data import/export.

You can globally enable or disable Synonyms function in the search using the switch located at the top of the side menu.  

Stop-words management

In some cases, products do not need to be displayed for some search queries. For example, on the website you sell Oil and Broilers. Thus, it is not logical to display Broilers products for the search phrase "Oil". To prevent such products from being displayed, you can add the stop word "Broiler" to the search phrase "Oil". You can add multiple stop words for one search phrase. A stop word is not necessarily a single word, it can be a whole phrase or a sentence.

Tip: Do not set too short stop words or words that can be part of the relevant word of other products. You can  inadvertently blocking relevant search results.

Stop words can be added using the admin panel interface, as well as through data import/export.

You can globally enable or disable stop words function in search with the switch located at the top of the side menu.  

Search motivation

You can use the Search Motivation feature to encourage search usage on your site. Create messages or suggestions for buyers that might interest them. You can set an unlimited number of messages, all of them will be displayed by typing emulation in the search field one by one.

You can turn the search motivation on or off with the switch located at the top of the side menu.

Search phrases

The "Search phrases" section is designed to manage suggestions when you start typing a search phrase in the search window, as well as to display the featured products set by the administrator for a specific search phrase. Recommended products are displayed regardless of whether they are relevant to the search query or not.
Create popular search terms for your website and save your customers' time.

On/Off toggle suggestions and Featured products are located at the top of the sidebar.

You can manage search phrases using the admin panel interface, as well as through data import / export.

Search speed-up

The search speed-up is meant for large catalogs — from 100 thousand products, when the results come back noticeably slowly. The add-on keeps its own search index of the product fields and looks the query up there instead of the product tables. The section is in the add-on menu: Search speedup → Speed-up settings and Search speedup → Products Indexation.

Speed-up modes

The SpeedUp Mode setting offers two modes, both working on the same index:

  • Recommended — the query is matched anywhere inside a word. Search results are not limited.
  • Hard (the extreme mode) — the query is matched by the beginning of words through a full-text database index. This is the fastest way for large catalogs: in our measurements on a catalog of 390 thousand products a one-word search takes 0.002 seconds instead of 0.43.
The extreme mode does not look for the query in the middle or at the end of a word. Typing "amsung" will not find products with the word "Samsung", while "Sams" will.

Switching between the modes requires no re-indexation. Words shorter than the minimum word length of the full-text index (the innodb_ft_min_token_size database parameter, usually 3 characters) are searched the usual way in the extreme mode — the exact number is shown on the speed-up settings page.

The fulltext search index

The extreme mode works through a full-text index that is created separately. On the Speed-up settings page open the actions menu next to the Save button and choose Create the fulltext search index. Once the index exists, the item is replaced with Delete the fulltext search index.

  • The index is only ever created by hand: neither the installation nor an upgrade of the add-on creates it.
  • Until the index is created, the extreme mode searches by substring like the recommended one, and the settings page shows a warning. The store is never left without a working search.
  • The server must run MySQL 5.6 or newer, or MariaDB.
While the index is being created, the index table is locked for writes and products cannot be saved. On 390 thousand rows it takes about 17 seconds. Pick a quiet hour for a large catalog.

The Search by a part of the product code setting (the Product search settings tab, shown when the search on product code is enabled, on by default) keeps the search by a part of the product code working in the extreme mode: the code is stored in the index together with its tails. It costs about 3 MB of index per 100,000 products. Turning the setting on or off requires re-indexation.

Products indexation

Before enabling the speed-up for the first time, index the products on the Products Indexation page. After that the index is kept up to date automatically when products are added or changed through the admin panel.

If products are loaded by third-party programs or external scripts, or the Skip indexation when import is runing setting is enabled, the indexation has to be run after every catalog update, manually or by Cron. The Cron commands and links — a regular one and one that clears the indexes first — are shown on the speed-up settings page; the key in them is set by the Cron key setting.

A full re-indexation: choose Clear all indexes in the actions menu next to the Save button, then run the indexation again.

When re-indexation is needed

The index stores the product text the way the settings shape it: the search fields and the selected features, Search by a part of the product code, the exception characters, Ignore accents and diacritics, transliteration. Change any of them and the built index no longer matches the settings. The speed-up settings page then shows the warning "The search index was built with different settings: the changes will only take effect after a full re-indexation of the products" — it stays on the page until the re-indexation is done. In a store with several storefronts the warning lists the storefronts concerned.

After upgrading the add-on to version 10.0.0 re-indexation is mandatory: the list of accented letters treated as their base letters has been extended. Choose "Clear all indexes" and run the indexation again.

Server recommendations

If the database server lacks something for the search to run at full speed, a recommendations block is shown at the top of the speed-up settings page. When everything is in place, there is no block. It may contain:

  • a MySQL version below 8.0.20 — on 8.0.20 and newer the database is given an exact instruction on how to build the search query, and several synonyms are checked in a single pass over the index;
  • MariaDB — the search works, but part of the speed-up is only available on MySQL 8.0.20 and newer;
  • a collation of the index table outside the general_ci family — with utf8mb4_general_ci several synonyms are checked in a single pass;
  • an InnoDB buffer pool (innodb_buffer_pool_size) smaller than the database — the search then reads its index from disk, which on a large catalog means seconds instead of fractions of a second. The add-on names the recommended value; it should stay below 70% of the server's RAM. The parameter is changed in the MySQL configuration — ask your hosting provider or system administrator.

Turbo cache

Turbo-cache is a cache that is formed based on user search queries. The results of each new search query are stored in the cache. In case the search query is already in the cache, the add-on bypasses the search query to the database and returns the list of products directly from the cache. This significantly reduces the response time and reduces the load on the server. At the same time, product prices are always fetched from the database. This means that you do not need to clear the turbo-cache if you are updating only the prices of products. Turbo-cache operates based on the Redis storage. To enable turbo-cache on your server, the Redis service must be installed and running.

 

To enable Turbo Cache on the server, the Redis service must be installed and running. If you attempt to enable Turbo Cache on the server when Redis is not available, you will see a warning message indicating the inability to activate Turbo Cache.

The Turbo Cache feature is optional. If you wish to start using Turbo Cache but Redis is not installed on your server, you should contact your server's technical support service to have it enabled.

When to manually clear Turbo Cache or schedule it:

Turbo Cache has built-in logic for self-cleaning based on cache lifespan or triggers (product updates or edits). If you use scripts for bulk importing products (creating products), it is recommended to clear Turbo Cache after each bulk import. If you have set up self-cleaning for product updates or changes, and products are edited or created from the admin panel, manual clearing is not required.

The self-cleaning feature for product changes or updates does not remove the entire Turbo Cache but only a portion of the cache (segments) that include the edited product. This allows Turbo Cache to operate more efficiently.

 

 

Upgrade an add-on

In order to have access to add-on upgrades, you must have an active upgrade subscription. If the subscription period has expired, you will only have access to upgrades released before the expiration date of your subscription. You can renew your upgrades subscription in the "License Management" section on our website.

The add-on supports instant upgrades via the CS-Cart Upgrade Center. The built-in CS-Cart Notification Center (bell) will notify you about new versions release of the add-on. Upgrades via Upgrades Center will allow you to switch to a newer version without losing add-on data and settings.

Before start an upgrade process, it is highly recommended to make a full backup of the site (database and files) of your store using the server or hosting methods. 

 Upgrade through the Upgrade Center

  1. In the top menu, go to Administration → Upgrade Center;
  2. In the gear menu, click "Refresh available upgrades"
  3. Find and add-on on list of available upgrades and click the Download button and than Install button;
  4. Follow all the instructions that will be shown during the upgrade process;
  5. It is recommended to clear the CS-Cart templates cache after the upgrades are installed by deleting the var/cache folder on your server or adding the ctpl parameter to the address bar (example: https://domain.com/admin.php?ctpl).

Addon Reinstallation by uninstall old and install new:

Reinstalling an add-on means deleting the add-on's settings and data. Reinstallation will allow you to get a clean installation of the latest addon version. To reinstall the add-on with saving the add-on settings and data, please contact us via our Support Center to provide this service.

To completely reinstall an add-on without saving data, follow these steps:

  1. Go to Add-ons → Manage add-ons and find the old installed add-on.
  2. Click the delete button in the gear menu of the add-on.
  3. Download the latest version of the add-on on our website in the "License Management" section.
  4. Go to Add-ons → Manage add-ons and in the gear menu select Manual Installation. Select the previously downloaded file and complete the installation of the add-on.

Technical support

The technical support of the add-on is already included in its price. Before contacting the support center, please make sure you are using the latest released version of the add-on. Old versions of the add-on are not supported by technical support.

To use our technical support, follow these steps:

  1. On our support center site https://helpdesk.cs-commerce.com/, log in with your account;
  2. Click on the "Create ticket" button;
  3. Fill in all the required fields and create ticket (you will receive a confirmation email);
  4. Expect a response from a specialist (a notification will be sent to your e-mail about the response) in accordance with the regulations of the technical support service.

If you have not received an answer within the time frame specified in the regulations, write us a message to the e-mail info@cs-commerce.com with the subject of the ticket and we will try to resolve your issue as soon as possible.

Technical support via chat on the site, direct phone calls or e-mail letters is not provided. All help discuss goes through the support center. Carefully study the documentation for the add-on and the terms of technical support before creating a ticket. 

 

Limitations and Warnings

We recommend that you familiarize with the general restrictions:

  1. Fragments of code or some files of an add-on may have a private (encoded) part. The coded part does not create problems on add-on customizations;
  2. The add-on will work only on those domains that are specified in the user's license. If you try to use the solution the domains of which are not included in the license, the add-on will be automatically disabled;
  3. Installing on local machines is not allowed by the licensing system. For the add-on to work on an additional domain (alias), specify this alias on the license management page. Up to three aliases are allowed per domain for testing and development purposes. You can change the main license domain yourself on the license management page.
To have possibility to add or change license domains and aliases, the upgrade subscription must be active. To change the license domain of an expired upgrades subscription, you must first renew your subscription.  

 

For developers

Professional settings

The For developers tab, in the Professional settings group, holds the Start the search query from the index setting. It defines where the database starts the search query when the search speed-up is enabled. The setting does not change the search results — only the speed. The order instruction takes effect on MySQL 8.0.20 and newer.

  • Automatically (default) — the add-on decides by the index shape measured by the last full indexation. Until a full indexation has been run, the search starts from the index.
  • Always start from the index — for a large catalog whose products all belong to one storefront, and when the index holds one language: the search word filters the products straight away, and the database reads the data of the found products only.
  • Leave the order to the database — if the index holds several languages, or the storefront owns only a small part of the products of a shared database.

A hint under the field shows the figures of your store: how many rows the index holds, how many languages are in it, what share of the rows a search request can use, and what the automatic mode has chosen.

PHP Hooks

The add-on does not support cs-cart php hooks, therefore, its own connection scheme was developed, which fits into the cs-cart connections.
The add-on has built-in hooks:

  1. hooks_get_products Variables: 
      $ls_settings - array() addon settings
      $company_id -  int() current storefront ID
      $params - array() query data
      $fields - array() fields to display
      $join - string() Join data
      $condition -  string() conditions string
      $sorting - string() sorting
      $limit - string() products limit
  2. hooks_get_joins Variables: 
     $ls_settings - array() addon settings
     $params - array() query data
     $join - string() Join data
  3. hooks_get_conditions Variables: 
     $ls_settings - array() addon settings
     $params - array() query data
     $condition -  string() conditions string
  4. hooks_get_fields Variables: 
     $ls_settings - array() addon settings
     $params - array() query data
     $fields -  array() fields array
  5. hooks_get_product_phrase_condition Variables: 
     $ls_settings - array() addon settings
     $part  - string() One of Parts of search phrase
     $tmp -  array() Array of part of phrase conditions
  6. hooks_get_speedup_product_data Variables: 
     $ls_settings - array() addon settings
     $product_id - int() Product ID
     $search_string -  string() String of values to be indexed
     $lang_code - string() Language code of indexation string
  7. hooks_get_categories Variables: 
     $ls_settings - array() addon settings
     $company_id - int() Current runtime company ID
     $params - array() query data
     $fields -  array() fields to be selected
     $join - string() Join data
     $condition  -  string() conditions string
     $cats_where -  array() Array of phrase conditions
     $limit  - string() limit of getting categories
  8. hooks_get_brands Variables: 
     $ls_settings - array() addon settings
     $company_id - int() Current runtime company ID
     $params - array() query data
     $fields -  array() fields to be selected
     $join - string() Join data
     $condition  -  string() conditions string
     $phrase_condition -  array() Array of phrase conditions
     $sorting - string() sorting data string
     $limit  - string() limit of getting brands
  9. hooks_get_pages  Variables: 
     $ls_settings - array() addon settings
     $company_id - int() Current runtime company ID
     $params - array() query data 
     $join - string() Join data
     $condition  -  string() conditions string
     $phrase_condition -  array() Array of phrase conditions 
     $limit  - string() limit of getting brands
  10. hooks_get_vendors  Variables: 
    $ls_settings - array() addon settings
     $company_id - int() Current runtime company ID
     $params - array() query data 
     $join - string() Join data
     $condition  -  string() conditions string
     $phrase_condition -  array() Array of phrase conditions 
     $limit  - string() limit of getting brands
  11. hooks_before_response Variables:
    $ls_settings - array() addon settings
    $company_id -  int() current storefront ID
    $params - array() query data
    $response -  array() data to response

Using the built-in add-on my_changes as an example, let's connect to the hooks_get_products hook, which is located before the request to receive products:

  1. Create a hooks.post.php file in the add-on's directory app/addons/my_changes/schemas/csc_live_search;
  2. Add  value to the $schema['developers']['hooks_get_products']['variants'] array, the key of which is the directory of the function file. Sample code for the hooks.post.php file:
    <?php
    if (!defined('BOOTSTRAP')) { die('Access denied'); }
    $schema['developers']['hooks_get_products']['variants']['/app/addons/my_changes/fn_file_name_same_as_function_name.php']='My changes hook function';
    return $schema;
  3. Create the appropriate file referred from the hooks.post.php file and create one function in it, the name of which is the same as the file name. In our case, this is fn_file_name_same_as_function_name, accept the sent variables and modify to get the necessary search conditions. Example file content:
    <?php
    if (!defined('BOOTSTRAP')) { die('Access denied'); }
    function fn_file_name_same_as_function_name($ls_settings, $company_id, $params, $fields, $join, &$condition, $sorting, $limit){
    	
    }
  4. Clear the admin panel cache, then go to the settings page of the live search add-on to the developers section and select the hook that you added in the selectbox. Save the settings.

Integration with the hook of the live search add-on is completed.

 

JQUERY Event

To have possibility to change product list, or add additional elements on search results popup we have added custom events. You can catch this event and make needed changes. There are two events:

  1. cls.after.insert - is triggered when user types and we insert html into search popup block.
  2. cls.after.append - is triggered when user press show more button and data is appended to search popup block.

How to use: Use $(document).on()) construction to catch event and make needed changes:

$(document).on( "cls.after.insert", function(event, data, elm) {	
});
$(document).on( "cls.after.append", function(event, data, elm) {	
});

Where data - is array of all items data, received from request, and elm - is block, where data was inserted.

Example, where we adding product code to end of product name:

$(document).on( "cls.after.insert", function(event, data, elm) {
    if (data.items){		
        $.each(data.items, function(i, product){			
            $(elm).find('.cls-product-card[data-pid="' + product.product_id + '"] ').append(" " + product.product_code);      
        });
    }    
});

 

Changelog

Changelog information about all add-on released versions is available via this link.

Version 10.0.0 of November 10, 2026: after the upgrade rebuild the search speed-up index ("Clear all indexes", then the indexation). The extreme speed-up mode works through the fulltext search index, which is created by hand on the speed-up settings page.