3.1.1
Quick Search
Add-on installation
After downloading the module, its installation is performed using standard CS-Cart tools on the page Admin Panel → Modules → Module Management → Download and install the module (+).
For CS-Cart version 4.16.1 and higher Admin Panel → Modules → Downloaded add-ons→ Gear button → Manual installation.
Add-on setting
Adding a block
For the search to work, you need to add the MS: Quick Search block to the layout.
- Go to the Website → Themes → section Layouts;
- Disable or delete the main search block;
- Press “+” to add a new block to the section;
- Open the “Create a new block” tab, select the “MS: Quick Search” block from the list;
- Fill in the ”Name“ field, go to the ”Content“ tab, select the ”All“ option for the ”Fill in" field;
- Click “Create".
Product cache generation
To ensure high speed and accuracy of the search, it is necessary to maintain an up-to-date cache of products.
In the General tab, you will find a link leading to the "Cache for search field" section in the Modules menu. Follow this link to configure the caching settings.
The "Cache for search field" section provides the following tools for working with product tables:
- Optimize table: This button starts the process of optimizing the existing cache. Use it to improve search performance after significant changes in the product catalog.
- Delete table: If you encounter problems with the search or want to completely clear the cache, use this function. It will delete the current cache table, allowing you to create it again.
- Cache for search field: Click on this button to start the process of creating a cache of goods. This is necessary for the initial configuration of the module, as well as for updating the cache when adding new products or changing existing ones.
Cron commands to start scheduled generation: To automatically update the cache on a schedule, use the provided cron commands. They will allow you to set up regular cache updates without having to manually run this process.
In the section “Cache for search field” there are three different cron commands, each of which updates the search cache, but does it in different ways:
- The command using PHP directly runs the script on the server. This is suitable for systems where it is preferable to use PHP to perform tasks.
- The Curl command sends an HTTP request to your site to initiate a cache update. This is convenient when you need to call a script via the web.
- The command using Wget also sends an HTTP request, but uses a different program. This method is suitable if Wget is installed on the server.
The choice of the team depends on your server settings and personal preferences in managing tasks on the server side.
Display Settings
Let's go back to the module settings.
In the Settings tab, you will find the following options to customize the display:
- Display code: Enable it to display the item number in the search results;
- Display price: Enable it to display the regular price of the product and the recommended price in the search results;
- Show category: Enable it to display product categories in the search results;
- Show 'Add to cart' button: Enable the Add to Cart button to be displayed next to each product in the search results;
- Show 'Add to Compare' button: Enable it so that the add to comparison list button is displayed next to each product;
- Show 'Add to Wishlist' button: Enable it so that the Add to wishlist button is displayed next to each product;
- Count of products: Specify how many products to display on one search results page;
- Count of categories: Specify how many categories to display in the search results list;
- Search Box style: Select the style of the search box;
- Round:
- Square:
- Display thumbnail: Enable it to display product images in the search results;
- Thumbnail size: Specify the width and height of the thumbnails of the product images in the search results. By default: width 40, height 40, size is specified in pixels;
Search Settings
In the Settings tab, you will find the following options for configuring the search operation:
- Advice grammar corrections: Enable this option so that the module offers corrections for possible grammatical errors in search queries.;
- Grammar advices limit: Set the maximum number of sentences for correcting grammatical errors;
- Sorting logic: Select the principle by which the products will be sorted in the search results;
- Timeout (ms): Set the delay in milliseconds between the first letter entered and sending the request to the server;
- Min characters for start searching: Set the minimum number of characters required to start the search;
- Items per one process of generating the cache: Set the number of products to be processed at a time;
- Search in descriptions: Enable it so that the search is also carried out by product descriptions;
- Search in product features: Enable it so that the search takes into account the characteristics of the goods;
- Search by brands: Enable it so that the search takes into account product brands;
Using the API for search
In the “Information” tab you will find information for API search:
- The entry point for the search
- Passing the search parameter
The URL for sending search queries can be found in the module settings. It is automatically configured for your domain.
Use the q parameter to pass the desired phrase.