User Tools

Site Tools


Sidebar

magento_2:advanced_search

See the way the Advanced Search for Magento 2 extension works.

Guide for Advanced Search for Magento 2

Let customers conveniently search Magento 2 products by names. Optimize quick search window according to users’ needs and customize auto-complete popup display to make searching easy-to-follow.

  • Enhance search results popup
  • Add handy tabs to navigate the results
  • Display popular and recent searches
  • Customize search window design
  • Show ‘View All’ link and ‘Add to Cart’ button
  • Analyze customers’ activity via Search Analytics dashboard

Configuration

To configure the extension settings, go to Admin Panel → Stores → Configuration → Amasty Extensions → Advanced Search.

General Settings

Expand the General tab.

Popup Width (px) - indicates the width of the autocomplete popup window to make it fit in with other page elements. The recommended value for the horizontal view is 900. To get a vertical view, please enter 700 and lower.

Search Field Width - Choose 'Default' to keep the original size of the search field during the searching process, or enable dynamic search field width (it will be based on a popup width).

Min Characters - specify the minimum number of characters that customers should type in to trigger the search process. By default, the number is three.

Enable Redirect from 404 to Search Results - if the option is enabled, when navigating to a broken URL or a non-existing page, a customer will be redirected to the store search results page instead of the '404 Not Found' page.

Custom URL Key for Default Search Results Page - enable to set SEO-friendly short URLs. URL will look 'search/yellow' instead of 'catalogsearch/results/q=yellow'.

Search Results Page URL Key - specify the URL alias for the search results page. Please do not use 'catalogsearch' as a URL Key value.

Enable Tabs on the Search Result Page - set to 'Yes' to enable the tabs that sort search results by Category, CMS, and Landing on the search results page.

See on the image below how the tabs will look like if some other extensions by Amasty are also enabled. These two extra tabs on the image become available if the Amasty Landing Pages for Magento 2 and Amasty Improved Layered Navigation for Magento 2 are installed. Some other extensions will add other tabs.

Enable Indexation for Autocomplete popup - Set 'Yes' to speed up autocomplete popup performance. The autocomplete popup indexation also covers the products indexation. Please note, the reindex will take longer. This feature comes with Amasty Elastic Search extension only.

If you are using Varnish cache when utilizing the custom URL, than to reduce the system load you should include this URL into the Varnish cache exceptions. Please, go to vendor/magento/module-page-cache/etc and select the file with the .vcl extension (depending on your Varnish cache version) and find the following code:
if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
return (pass);
}

Here you need to add the custom URL to exceptions in the IF clause. For example, for the search URL the code will be the following:

if (req.url ~ "/checkout" || req.url ~ "/catalogsearch" || req.url ~ "/search") {
return (pass);
}

Show Related Queries in Search Results - adjust if the search should show to a customer the related search results. To learn how to assign related terms, please go to the Related Search Terms part of the guide.

  • No - no related search items won't be displayed.
  • Yes, Show Always - the related search items will be shown for any search request.
  • Yes, Show Only When Search Returns 0 Results - if you don't have a perfect match for a specific request, the Advanced Search module will display related results to help the customer.

Show Related Search Queries Result Numbers - decide on the number of search results displayed for related requests.

Replace Empty Search Result Message with CMS Block - Choose 'No' from the dropdown if you want the zero search results page to remain empty. Or just pick up any CMS block from the list of your blocks to be displayed in case there are no search results matching the search term.

See an example of how this option can be configured below:

Search Attributes

You can include any available product attributes in the search algorithm. For each attribute, you can set a priority (weight).

Click Add to create a new attribute. Use the bin icon in the Action column to delete attributes in one click.

If there is a color attribute with weight 10 and description attribute with weight 5, and the query is red, search results will be more visually relevant, because the algorithm will choose color attribute prior to the words in description.

You'll also see in results such configurable products that have simple ones with the relevant attribute (e.g. like the tee with the product option 'red color').

See our Elastic Search for Magento 2 extension that offers a flexible work with a search query and extensive configuration of product attributes.

Products

Expand this tab to configure products display in a popup window.

Enabled - set to 'Yes' to enable search in products and display search results in the autocomplete popup.

Title - customize the title for the products block.

Position - specify products block position in the popup. This setting is ignored for the horizontal popup window.

Max Results - set the max number of displayed results.

Name Length - indicate the max number of characters of a product name that will be displayed in a popup window.

Short Description Length - set the number of characters for a product short description to be shown in a search window.

Please note that if you are using the default extension settings, the short description display for a product will be enabled. If you want to disable it, please specify the 'Short Description Length' as 0 (zero).

Show Reviews - enable reviews display in the autocomplete popup to help customers make the purchase decision much faster.

Enable 'Add to Cart' button - set to 'Yes' to show Add to cart button in the popup to let customers purchase necessary products right away.

Redirect to Product Page - enable this option to redirect in case there is only one search result available.

Show 'Out of Stock' Products Last - enable a feature to place the out-of-stock items last in the search results.

To make this feature works properly with out-of-stock items being displayed correctly, please make sure that out-of-stock items' visibility is enabled.
  • Go to Admin Panel → Stores → Configuration → Catalog → Inventory → Stock Options.
  • Navigate to a Display Out of Stock Products field → Uncheck Use system value and set to 'Yes'.
Out-of-stock items displayed last in the search results, a sample.

To use and configure Relevance Rules please install the Magento 2 Elastic Search extension first.

Apply Relevance Rules to Autocomplete Popup Results - Set 'Yes' to apply Relevance Rules to search autocomplete popup results.

Please note that if this setting is enabled, applicable relevance rules (created in Elastic Search module) will impact not only the search results page, but the search popup as well.

How to locate the search bar in other places than the default?

By default, the advanced search bar is located at the top right corner of the screen, near the shopping cart. But using widgets you can overcome Magento limitations and place the search bar anywhere you need all through the store, like on a sidebar, in the footer, on the CMS pages, and even in Customer Account.

There are two ways of how to configure some non-trivial location for the search bar:

  1. configure the widget and specify 'Layout Updates';
  2. configure the widget, configure a custom block with it, and then use this block (for example, on a CMS page).

For using the first way, please navigate to Content → Widgets and click on the 'Add Widget' button. Choose the relevant theme to be applied for this widget and the widget type 'Amasty Search Field'.

Specify widget title, needed store views, and the widget sort order.

First, please choose if you want to embed your widget on Categories (anchor or non-anchor), Products (depending on the product type), or Generic Pages. Depending on that choice you'll see the available containers for that type of a store page.

As per products and categories you can choose whether to display the widget on all store product/category pages in bulk or on the specific only.

As per Generic pages, there's the choice from three options, depending on which you'll see the unique set of the available containers:

  • All Pages;
  • Specified Page;
  • Page Layouts.

When you're ready with all configurations, please refresh the page where you're expecting to see the widget and try flushing Magento Cache ('System → Cache Management → Flush Magento Cache') to see the result on the frontend immediately.

For the second way of locating the search bar anywhere else than the default please create the 'Amasty Search Field' widget first and then please go to 'Content → Blocks' to integrate that widget on some of the existing blocks or for creating new.

See the example of how this widget looks on the frontend (sidebar category menu):

Additional Blocks

Extend the search popup with additional sections.

Enabled - enable the display of the Popular Searches block.

Show on First Click - set the option to Yes to let customers see the Popular Searches block in the autocomplete popup once they click on the quick search field.

A sample

Title - specify the title of the block.

Position - set the position for the Popular searches block.

Max Results - set the maximal number of popular search results that will be displayed in the search autocomplete popup.

Browsing History

Enabled - Set this setting to 'Yes' to allow the logged-in customers to see their latest search queries in the autocomplete popup.

Please note that this option ('Browsing History' display) is available for the registered (logged-in) customers only.

Show on First Click - Set this option to 'Yes' to enable showing the 'Browsing History' block at the first user's click in a popup.

Title - In this field, you can specify any custom title for the 'Browsing History' block.

Position - In this field, you can specify the position (display order) of the 'Browsing History' block within the search autocomplete popup.

Max Results - Here you can set the maximal number of results from the browsing history that will be visible in the popup. Or you can just use the system value which is 4 (four).

Please find below the samples of how the 'Browsing History' block can look like on the frontend:

Recent Searches

Enabled - select Yes to display the Recent Searches block.

Show on First Click - set the option to Yes to let customers see the Recent Searches block in the autocomplete popup once they click on the quick search field.

Specify the Title, Position and Max Results to be displayed.

Display Recent Searches in a pop-up

Blog

Enabled - set to Yes to enable search by blog pages and to display a blog section in the search window popup to help store visitors find the required content throughout your corporate blog.

Allows to search by blog pages created with Amasty Blog Pro extension.

Title - input a name for the section in the search popup, where the blog results will be displayed.

Also specify the Position, Max Results.

Set Content Heading Length and Content Length to be displayed to make your search autocomplete window look informative and clear.

Brands

Enable to display a Brand section in the search window popup.

The option allows to search by brand pages created with Amasty's Improved Layered Navigation and Shop by Brand extensions.

Specify the Title, Position, Max Results, Content Heading Length and Content Length for Brands block.

Categories

Enable the option to let the extension search among category attributes and display the results in the autocomplete popup.

Specify Categories block Title, Position and the max number of displayed Results.

Name Length - indicate the number of characters of a category title that will be displayed in a popup window.

Description Length - set the number of characters for a product short description to be shown.

Display Full Category Path - set to Yes to show the full path to the results displayed in the popup.

When mouse hover over a category link, the directory levels are displayed.

CMS Pages

Enable search on CMS pages to provide customers with detailed search results.

Specify the Title, Position and the Max Results.

Also, set the maximal number of characters for Content Heading and Content that will be shown.

Recently Viewed

Enabled - Set 'Yes' to enable the 'Recently Viewed' widget in the autocomplete popup.

Title - In this field, you can specify a custom title for the widget.

Max Results - Here you can specify the max number of products to be displayed in the slider.

Please note that the 'Recently Viewed' widget (in a form of a slider with recently viewed products) will be displayed only till the moment a user starts typing.

Bestsellers

Please note that this widget will work only if the Improved Sorting for Magento 2 by Amasty extension is also installed.

Enabled - Set 'Yes' to enable the 'Bestsellers' widget in the autocomplete popup.

Title - In this field, you can specify a custom title for the widget.

Position - If the widget 'Recently Viewed' is enabled, you can specify in which order these two widgets will be displayed (which one first).

Max Results - Here you can specify the max number of products to be displayed in the slider.

Please note that the 'Bestsellers' widget (in a form of a slider with recently viewed products) will be displayed only till the moment a user starts typing.
See how the widgets 'Recently Viewed' and 'Bestsellers' look like on the frontend:

Landing Pages

Enable search landing pages in the popup, specify the Title, Position and the Max Results. Set the maximal number of characters for Content Heading and Content that will be shown in the search popup.

Allows to search by landing pages created with Amasty Landing Pages extension.
Search Landing Pages

To display Landing Pages instead of the search results page, go to Admin Panel → Marketing → SEO & Search → Search Terms → Press Add New Search Term.

  • Input expected Search Query;
  • Specify the Store;
  • Redirect URL - input the URL of the landing page.

FAQ Question

Enable search FAQ pages in the popup, specify the Title, Position and the Max Results. Set the maximal number of characters for Content Heading and Content that will be shown in the search popup.

Custom Layout

Enable this option to customize popup design.

Set colors for a Border, Hover, Highlight, Background, Text and Hover Text using convenient color picker tool.

See custom layout example:

Analytical Dashboard

The Advanced Search extension allows to maximize profits by analyzing visitors' searching activity and the data gained.

To see the Search Analytics dashboards, go to Admin Panel → Reports → Search Analytics.

Here you can see the next values: total searches, unique searches, the number of users and users’ engagement. The Engagement statistics includes the page jumps to Brands, Categories, Blog, CMS & Landing pages.

Easily check customers’ demand in the Most Wanted Search Terms and Recent Activity blocks. The extension automatically records the activity of users on the front end and converts it into reports on the back end.

To see more details on Most Wanted Search Terms, go to Admin Panel → Reports → Most Wanted.

Please note that the Engagement metric is about the engagement with the autocomplete popup of the extension only, i.e. if shoppers click on the links in a popup, add products to cart etc. If they just type a search term and press 'Enter' without any extra popup engagement, then such action will not be counted in the engagement stats.

To see more details on customers' Recent Activities, go to Admin Panel → Reports → Recent Activity.

This extension lets store admins construct a seamless search flow with the related search terms. It is highly useful for customers, as it helps to navigate the store with relevant search suggestions.

Start by overseeing all search terms, that users created in the store by organically entering search requests in the autocomplete search window. To access it, please go to the Admin Panel → Reports → Search Terms.

Here, you can see how each search word performs. You can also export it in the CSV or Excel XML formats just in one click. Also, easily add new search terms or edit them.

Press on the required search term to modify it.

Here, the admin can adjust the general information and assign related terms.

Search Query - enter the search request a user needs to type into the search field.

Store - assign the store view for a specific keyword.

Number of Results - it specifies, how many search results will be returned.

Number of Uses - this number signifies how many times visitors have requested this specific search query.

Redirect URL - enter the URL you want to redirect users to when clicking on search results.

Display in Suggested Terms - set to Yes to show this search word in the Related Terms list for other search requests.

In the Related Terms table you'll get a list of all search terms that are enabled for display in suggested terms. Mark the necessary ones that match your goal by ticking the checkmark. This way, it will be much easier for a customer to navigate your store even if they've misspelled the search requests. Also, it's a great opportunity for a store owner to promote relevant searches that might be interesting for a customer and therefore motivate them to purchase in your store.

Magento Commerce and the Multiple Wishlist extension compatibility

The Magento Commerce version of this extension provides some extra opportunities for the wishlist management in cooperation with the Magento 2 Multiple Wishlist extension.

Provide customers with the ability to choose the wishlist where to save the product, right from the autocomplete popup.

NOINDEX

To prevent search engines (Google, Bing, Yahoo, etc.) from needlessly indexing Magento catalog search results page(s) and advanced search results page(s) we added the code to app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout/local.xml.

  • If this file does not yet exist in your custom theme you can create it and Magento will automatically include it.
  • If this file already exists in your custom theme then copy everything except the first line XML declaration and elements into your copy of local.xml.

Reindex Categories

To reindex categories for correct search results, go to System → Tools → Index Management

Frontend Samples

Enhance search results pop-up with additional sections. Display the ‘Add to Cart’ button and ‘View All’ link right in a search pop-up window.

Add handy search tabs to sort and easily navigate the results. Display related search terms in the search results to encourage users to search more.

Display the most popular and recent search results right on the first click by the customer.

The extension package contains MFTF tests aimed at quality and stability enhancement.
Advanced Search for Magento 2 extension is compatible with the built-in Magento EE Sorl & Elastic Search and AJAX Shopping Cart for Magento 2.

Find out how to install the Advanced Search extension for Magento 2 via Composer.
Rate the user guide
 stars  from 2 votes (Details)
magento_2/advanced_search.txt · Last modified: 2021/06/29 12:04 by tihomirova