Live search addon for cs-cart

Live search add-on

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;
  • Build in search speed-up functionality (for hardloaded projects with more than 100 000 products).
  • [NEW!] Build 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.

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.

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

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. Also, the more synonyms for a search phrase, the slower the search for such phrase.

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 devepoped for highly loaded projects with a more than 100 thousand products and search results are given slowly. How the Search Speed-up works:

  • Product indexing makes product clusters based on the first letters of all words of the indexed product fields.
  • The cluster size is the number of letters that will form the cluster. Recommended setting for Latin and Cyrillic layouts is 2.
  • During a search query, the speed-up function determines which clusters the search phrase is related to and searches for products only within these clusters.

Thus, the amount of data for search is reduced by several times, and often by dozens of times. 

The search speed-up has limitations on search results. It doesn't look for a search phrase in the middle or end of a word. The search will always work based on the first letters of the search phrase. For example, if a user types "amsung", then products with the word "Samsung" in their names will not be found. At the same time, the search will successfully return such products to the request "Sams". 

Indexation is automatically on updating products in the admin panel, but before you enable the speed-up function for the first time, please, don't forget to start indexing products.

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 (groups or clusters) 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 [email protected] 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

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('li[pid="' + product.product_id + '"] .clsProduct').append(" " + product.product_code);      
        });
    }    
});

 

Changelog

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