Welcome to the Search Autocomplete & Suggest Guide!
Our Search Autocomplete & Suggest Documentation not only allows your customers to have quick and relevant autocompletion during search, but also provide searching tips, which will help them to locate their goal more quickly.
First, please find your extension in your account in My Downloadable Products section, and then proceed with Installation. It is best to follow our step-by-step guide in order to configure the best search results.
Go ahead, dive in!
Our extension works out-of-the-box, so after installation you need just to tune-up its settings for more effective work.
This should be a good beginning!
How to install extension
- Backup your store database and web directory.
- Login to SSH console of your server and navigate to root directory of Magento 2 store.
- Copy installation instructions from page My Downloadable Products to SSH console and press ENTER.
- Run command
php -f bin/magento module:enable Mirasvit_Core Mirasvit_SearchAutocomplete
for enable extension.
- Run command
php -f bin/magento setup:upgrade
for install extension.
- Run command
php -f bin/magento cache:clean
for clean cache.
-
Deploy static view files
rm -rf pub/static/frontend/*; rm -rf pub/static/backend/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy
How to install extension
- Backup your store database and web directory.
- Login to SSH console of your server and navigate to root directory of Magento 2 store.
- Copy installation instructions from page My Downloadable Products to SSH console and press ENTER.
- Run command
php -f bin/magento module:enable Mirasvit_Core Mirasvit_SearchAutocomplete
for enable extension.
- Run command
php -f bin/magento setup:upgrade
for install extension.
- Run command
php -f bin/magento cache:clean
for clean cache.
-
Deploy static view files
rm -rf pub/static/frontend/*; rm -rf pub/static/backend/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy
Configuring Autocomplete & Suggest
All Autocomplete settings are located at System / Settings / Mirasvit Extensions / Search Autocomplete section.
It consists of the following sections:
General Configuration
This section also breaks into lesser subsections, and contains the following options:
- Minimum number of characters to search - specifies the minimum amount of characters, which customer should enter to trigger autocomplete.
- The delay to start finding - specifies delay between triggering autocomplete. (by option above) and beginning of actual search.
Note
Our extension actually begins to search for possible autocompletions and suggestions only when both conditions match:
- customer had entered minimal required number of characters;
- there were no actions during specified delay period.
Fast Mode - Option allows to increase search speed due to the excluding Magento 2 from the autocomplete search at the initialization stage.
Note
- This option is available for Sphinx search and Elastic engines only;
- The disadvantages include the increased indexing time of the search index, and the lack of some search capabilities, such as wildcard exceptions, individual search weight, Popular suggestions, Products in categories, number of found search results etc.
Searchable content - list of search indexes, where search is performed, and results displayed as autocomplete options. Indices are either taken from standard Magento, or if the extension is installed as part of Magento 2 Elasticsearch Extension or Sphinx Extension - from corresponding Indexes grid.
Note
The grid contains next settings:
- Index - name of index, which can be included to autocomplete.
- Is Enabled - includes current index to autocomplete
- Max Number of results - the maximum number of results, which should be displayed in autocomplete drop-down widget.
- Popular suggestions - based on the default Magento Search Terms. You can control it or modify at Marketing > SEO & Search > Search Terms.
- Products in categories - is not a Category Index, Products in categories is taken from product results: the more matches the search query with products are found in the category, the higher the category will be in the list. Unfortunately, there is no option to control or modify it.
You can drag and drop rows in this list to define order, in which results from different indices will be displayed in autocomplete drop-down.
Enable TypeAhead - enables auto-suggestion feature. Our extension collects information about most popular search queries and their results, groups them and stores separately. When autocomplete is triggered and TypeAhead option enabled, our application automatically searches for typed term and displays suggestion of found most relevant query.
Tip
Use Right Arrow button to quickly turn auto-suggestion to full autocomplete query and save autocomplete time.
Product Settings - defines content and appearance of autocomplete individual product information cells.
- Show Price - displays price or price range of products. Will show only final_price of the product if Fast mode is enabled.
- Show Thumbnail - displays small thumbnail of product image.
- Show Rating - displays number of reviews and approval rating (so-called star rating).
- Show Description - displays short excerpt from product's description.
- Show SKU - displays SKU of the product.
- Show "Add to cart" - displays shortcut button for quick purchasing products.
- Optimize the autocomplete view for small screen size - allows optimization of autocomplete layout to small screen sizes. Note: may require additional style fixing at Appearance section.
- Appearance - contains only one field, which defines custom appearance of autocomplete widget.
- Additional CSS Styles - custom CSS styles, that should be applied either to entire drop-down, or to individual product cells. It is extremely powerful tool, which allows you to fit our Autocomplete extension to almost any theme.
Example
To customize individual product cell in autocomplete drop-down, use the following expression:
.searchautocomplete__item-magento_catalog_product
{
// Your extended styles
}
It will be added to our stylesheet.
Hot Searches
Hot searches are the most popular queries, which were requested by customers. If current customer request includes such a query, autocomplete can highlight them and put to the top of drop-down.
FAQ
This section describes the most common problems, that customers report, and how they can be resolved:
- How to make the autocomplete dropdown scrollable and smaller for mobile devices
- How to make the autocomplete show a product price including or excluding tax
- Keep getting error onto each search page: The page you requested was not found, but we have searched for relevant content.
- After enabling Mirasvit_SearchAutocomplete my CSS styles are missed on frontend
- Does Mirasvit Search support REST API?
- Singular/Plural search: how it works?
For this navigate to the Stores > Settings > Configuration > Mirasvit Extensions > Developer > CSS Settings and add the css styles below to the Additional CSS Styles field:
@media screen and (max-width: 767px) {
.mst-searchautocomplete__autocomplete {
max-height: 200px;
overflow-y: scroll;
}
}
max-width: 767px
- is the maximum width of the device for which these styles are applied.
How to make the autocomplete show a product price including or excluding tax
For this navigate to the Stores > Settings > Configuration > Sales > Tax > Price Display Settings and switch the option Display Product Prices In Catalog to Excluding Tax - to display price without taxes or any other option to display price including tax.
Keep getting error onto each search page: The page you requested was not found, but we have searched for relevant content.
This issue is possible if some page contains resources (js, css, images) with a 404 error.
To prevent this issue, you can disable a 404 search at System -> Search Management -> Settings -> Mirasvit Extensions -> Search.
After enabling Mirasvit_SearchAutocomplete my CSS styles are missed on frontend
Please follow to System -> Search Management -> Settings -> Mirasvit Extensions -> Developer -> CSS Settings tab, set YES at Enable preprocessed CSS, then flush cache and run static content deploy.
Does Mirasvit Search support REST API?
Since Native Magento provides search API thus our search extension uses it as well, please follow the official documentation here
Singular/Plural search: how it works?
Our search extension supports singular and plural search out of the box for the EN, NL, RU locales. If you need to add support for other languages, use lang analyzer technology to customize your Elastic Search for the appropriate language.\
For the Sphinx extension, please use Sphinx engine version with Stemmer (with language specific morphology).
Translation
Our extension supports multilanguage stores. To translate it, we have used the same logic as default Magento.
- General Information
- Example
All our translation files are in the "/i18n" folder of each sub-module.
i18n files should be located at:
- vendor/mirasvit/module-name/src/ModuleName/i18n - if installed via composer;
- app/code/Mirasvit/ModuleName/i18n - if installed manually.
Create a separate .csv file of your language for our extension. The names of all languages can be found with this command:
php -f bin/magento info:language:list
Override the strings in your dictionary file:
"Original line" , "Translated line"
To avoid rewriting the file with the updating of the module, replace the translation file to your theme directory at app/design/frontend/THEME_VENDOR/theme_name/i18n/lg_LG.csv.
Where lg_LG.csv is a translation file in another locale.
To apply changes run static content deploy :
rm -rf pub/static/*
rm -rf var/view_preprocessed/*
php -f bin/magento setup:static-content:deploy
php -f bin/magento cache:flush
Example: translate "Sorry, nothing found for" and "Show all results" in Autocomplete:
- Open src/SearchAutocomplete/i18n/ directory to find the translation files;
- Make a copy of original en_EN.csv file, for example, nl_NL.csv file;
- Open nl_NL.csv file for editing;
-
If Fast Mode enabled at the Autocomplete settings
Change lines as below:
"Sorry, nothing found for ""%1."" change %1 to %s
"Show all %1 results →" change %1 to %d
"Sorry, nothing found for ""%s."", "Sorry niets gevonden voor ""%s.""
"Show all %d results →", "Toon alle %d resultaten →"
4) Temporarily disable a Fast mode in the autocomplete settings;
5) Run static content deploy;
6) Enable Fast Mode and run Magento reindex.
-
If Fast Mode disabled at the Autocomplete settings
Change lines as below:
"Sorry, nothing found for ""%1."", "Sorry niets gevonden voor ""%1.""
"Show all %1 results →", "Toon alle %1 resultaten →"
4) Run static content deploy;
Please do not add both kinds of translations in your locale file for a Fast mode enabled and disabled option. It will not work.
How to upgrade the extension
To upgrade the extension follow these steps:
- Backup your store database and web directory.
- Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
- Run command
composer require mirasvit/module-search-autocomplete:* --update-with-dependencies
to update current extension with all dependencies.
Note
In some cases the command above is not applicable, it's not possible to update just current module, or you just need to upgrade all Mirasvit modules in a bundle. In this case command above will have no effect.
Run instead composer update mirasvit/*
command. It will update all Mirasvit modules, installed on your store.
- Run command
php -f bin/magento setup:upgrade
to install updates.
- Run command
php -f bin/magento cache:clean
to clean the cache.
-
Deploy static view files
rm -rf pub/static/frontend/*; rm -rf pub/static/backend/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy
Disabling the Extension
Temporarily Disable
To temporarily disable the extension please follow these steps:
- Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
- Run command
php -f bin/magento module:disable Mirasvit_SearchAutocomplete
to disabled the extension.
Remove the Extension
To uninstall the extension please follow these steps:
- Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
- Run command
composer remove mirasvit/module-search-autocomplete
to remove the extension.
- Run command
php -f bin/magento setup:upgrade
.
Change Log
1.2.10
(2022-01-04)
Fixed
- The request query and filters error on empty search autocomplete query
- Wrong category url for multistore
- Wrong category url in fast mode
- Wrong add to cart url in search autocomplete
1.2.9
(2021-06-30)
Features
- Mobile autocomplete issue
- Autocomplete stock status issue
1.2.8
(2021-01-28)
Features
1.2.7
(2021-01-12)
Fixed
- Incorrect product stock status shown
- Blank autocomplete block when hot searches disabled
- Incorrect product url in search autocomplete with fast mode enabled on multistore
1.2.6
(2020-12-14)
Fixed
- missing price in autocomplete fast mode
1.2.5
(2020-11-26)
Features
- display stock status in autocomplete
Fixed
- duplicates error on show rating enabled
1.2.4
(2020-10-15)
Improvements
1.2.3
(2020-07-23)
Fixed
- Replace new lines with space (missing products in fast mode results)
Improvements
- Hide search on search icon click
1.2.2
(2020-07-08)
Fixed
- wrong price data in fast mode
- show search term in fast mode empty results text
- display search results in line
- open result in new tab by image shift click
- product reviews backward compatibility
- misproportioned images
- added comment for incompatibility with Fast Mode Autocomplete
- getRating fix
- decrease fast mode reindex server load
- unknown column "score" issue
1.2.1
(2020-05-14)
Fixed
- Amasty Blog posts links
- remove get params from URLs in fast mode for some cases
1.2.0
(2020-05-07)
Fixed
- compatibility with maria db
- increase search autocomplete fast mode reindex speed
- remove search box JS from checkout page to avoid conflicts with 3rd party
1.1.109
(2020-04-24)
Fixed
- ">" mark display issue
- no word wrap on results title
- filter out suggested search terms with mysql entries
1.1.108
(2020-04-07)
Fixed
- decrease server load in the fast mode
- wrong category url
- wrong add to cart action in the fast mode
- fast mode product urls different from regular results
- 'category product' index display issue
- apply fast mode translations
1.1.107
(2020-03-04)
Fixed
- old search results are visible while new search is running
- wrong product url in fast mode
- in-stock product filter already applied issue
1.1.106
(2020-02-12)
Fixed
- Invalid attribute name: store_id on reindex
- Category product arrow styling issue
- Wrong product url on multi-store results when fast mode enabled
1.1.105
(2020-01-02)
Fixed
- Disable native search autocomplete
1.1.104
(2019-12-18)
Fixed
- Blackbird contentmanager index
1.1.103
(2019-12-16)
Fixed
- Add blackbird contentmanager index
Improvements
- Product search index refactoring
1.1.102
(2019-12-09)
Fixed
1.1.101
(2019-12-03)
Fixed
- Wrong search results breadcrumbs
- Rating issue
1.1.100
(2019-11-25)
Improvements
- Use default magento price block for search autocomplete
1.1.99
(2019-11-25)
Fixed
- Unable to apply 'Add to Cart' translation
- Missing product rating
- Category index results wrong urls in fast mode
- CMS page index results wrong urls in fast mode
1.1.98
(2019-11-14)
Fixed
- Conflict with Webkul ShowPriceAfterlogin
1.1.97
(2019-11-12)
Fixed
- Search Button is not clickable when selecting the term from the Hot Searches
1.1.96
(2019-08-08)
Fixed
1.1.95
(2019-08-06)
Fixed
- Prices issue for multistore setup in 'Fast Mode'
- Product thumbnails issue in 'Fast Mode'
1.1.94
(2019-07-31)
Fixed
- Issue with autocomplete visibility, even if cart popoup was showed
1.1.93
(2019-07-30)
Features
- Fishpig Glossary index support
Fixed
- native search form active state
- nested environment emulation error
- reindex speedup
- Blinking autocomplete box with multiple search forms on the same page
1.1.92
(2019-06-19)
Fixed
- Render html entities on server side
- KB article typo in template
- Remove .active when on autocomplete miss focus
1.1.91
(2019-04-26)
Fixed
Improvements
- Added message after fast mode enable
1.1.90
(2019-04-24)
Fixed
- Ensure search autocomplete Fast Mode config file on reindex
- Display Fast mode indexes in correct order
1.1.89
(2019-04-12)
Fixed
- incorrect module conflict declaration
1.1.88
(2019-04-08)
Fixed
- Similar results in multiple attribute indexes
1.1.87
(2019-04-01)
Fixed
- Translations for search in stores with fast mode
Improvements
- Improved weighting, ability to use advansed search options, synonyms, stopwords
1.1.86
(2019-03-13)
Fixed
- Search in stores with fast mode