↑↓ selectEnter openEsc close

    1. Elbuz

    How to add smart search to your site

    3 min readUpdated

    Elbuz smart search replaces the search bar on OpenCart, WooCommerce, WordPress, Shopify or any other CMS: enter the site address and field CSS selector, then paste the code.

    When you need this:

    • Your site runs on any CMS — one script, independent of the site engine.
    • On phones search hides behind a magnifier icon — a mobile button selector opens it.
    • The first click shows “Loading...” — “Fast search opening” loads the widget with the page.
    • “Add to cart” in the search window must work — the widget calls your site's JS function.

    Where to start: fill in the address and selector in the widget card and paste the code.

    What the search widget does

    How to add the widget to your site

    Setup takes two settings and one pasted code snippet. An Elbuz CMS store needs nothing pasted: search turns on by itself when the store is created (what turns on automatically).

    1. Site address — the site where the widget will run.
    2. CSS selector to replace the search field — the spot on the page where the widget goes. Usually it's #search or your theme's search bar class. The CSS selector for the search button on the mobile version is set separately: on phones the bar is often hidden behind a magnifier icon.
    3. Integration code — copy it from the widget card and paste it into your site's <head>. It's a small script that loads the current widget version by itself.

    For common platforms the card has “Site CMS” and “Design theme” fields — they tell the widget how the layout is built. To see the result before pasting the code on your live site, use “Open demo site”; to check the results themselves, use the “Search test” tab.

    Fast search opening

    By default the widget doesn't start right away but after signs of a live visitor: mouse movement, a touch, scrolling. Bots that just load pages show no such signs, so the search service isn't spent on them. The trade-off: the first click in the search field sometimes shows “Loading...” while the widget finishes loading.

    The “Fast search opening” toggle on the “Settings” tab removes this delay: the widget loads together with the page, and what the shopper does before loading finishes — a click in the field, the first letters — isn't lost and runs as soon as the widget is ready.

    The downside is weaker bot protection: the widget still recognizes known bots by browser name and doesn't start, but a bot posing as a regular browser will call the service, and there will be more requests.

    • The toggle is off by default.
    • Once you save the card, the server starts filtering out bots by browser name right away. Fast start itself turns on for each visitor from their next page view: the first time, the widget learns the setting and starts as usual. After you turn the toggle off, one more page view also runs in fast mode.
    • After turning it on, check on an iPhone that the keyboard opens on the first tap in the search field.

    Store details aren't filled in separately: the widget takes the name, address, phone, email, opening hours, delivery, payment and social links from the company details.

    • The widget waits up to 120 seconds for the site to respond; if the site doesn't respond, an error message appears and the fields stay unchanged.

    How to set up the search window look

    How to show results

    • Results as you type — results update with every letter, without waiting for a pause. Only one request per shopper runs at a time, so the service isn't overloaded. AI spell checking and refining suggestions are requested only after a pause in typing.
    • Autocomplete — the rest of the query in faded text in the bar; Tab accepts it, the arrow keys switch suggestions, Esc closes the window.
    • Results link — the “share” button copies an address that opens the same search with the same filters.
    • Window type — embedded under the search bar or full-screen.
    • List view — grid or list, with an option to let shoppers switch.
    • Pagination — classic, a “Show more” button or infinite scroll.
    • Dark theme — always light, always dark or per device settings.
    • Texts — the hint in the search field, the text in the window header and footer, words for the typing animation in the bar.

    What shoppers see in the search window

    • Window with no query — the shopper's search history (last 5 queries), popular queries, popular categories and popular products grouped by category. Partial input (“lap”, “lapt”) doesn't get into popular queries or history.
    • Query suggestions and matching categories with product counts.
    • Sorting — by relevance, cheapest first, most expensive first, newest.
    • Product card — photo, name, specifications, rating and number of reviews, price, old price, discount in percent, availability; optionally SKU, , barcode, warranty, model. The card border can match the product color from its name.
    • “Details” without leaving the page — specifications, description, manuals, video, files, the “New”, “Popular” and “Best price” badges, delivery, payment, warranty, returns, store contacts and messengers, reviews and a review form. Alternatively, you can send shoppers straight to the product page.
    • Comparison, favorites, cart — buttons on the card and a panel with the lists in the search window.
    • Catalog — the store's category tree via the “Catalog” button in the search window.
    • Voice search — speech recognition by the browser, 15 languages.
    • Banners above the results — “Showing results for …” when the query was corrected; “No exact match — showing similar products”; “The products found are currently out of stock”; “Nothing found” with a “Reset filters” button. When each one appears — in how search understands typos.
    • Phone — a separate search button, filters in a slide-out panel, comparison, favorites and cart buttons at the bottom of the screen.

    Filters

    Each is turned on separately: by price, by brand, by availability, by attributes. There's an “Apply filters with a button” toggle — without it, results rebuild on every checkbox.

    How to set up links and cart buttons

    The widget lives on your site, so it needs to know where to send shoppers. You set link templates for the product, category, photo, search page, cart, checkout, comparison and promotions.

    Action buttons — “Add to cart”, “Add to Wishlist”, “Add to comparison”, “Details” — work through your site's JS code: for each action you specify the function to call. Without it, the buttons are shown but do nothing.

    If products came from an external marketplace and their link is stored in the links to external sources, enter the source code and the template , and use the {external_url} macro in the link template.

    Scenarios

    On phones the search bar is hidden behind a magnifier icon

    What to do. Besides the CSS selector of the search field, fill in the CSS selector for the search button on the mobile version and save the card.

    What you get. On phones, search opens with this button, filters are in a slide-out panel, and comparison, favorites and cart buttons are at the bottom of the screen.

    What won't happen. Without this selector, search doesn't open on phones.

    The first click in the search field shows “Loading...”

    What to do. Turn on “Fast search opening” on the “Settings” tab, save the card and check on an iPhone that the keyboard opens on the first tap.

    What you get. The widget loads together with the page, and the click and first letters typed before loading finishes aren't lost.

    What won't happen. The first page view after saving still runs in normal mode. Bots posing as a browser aren't filtered out by the widget.

    Shoppers should add products to the cart right from the search window

    What to do. Set link templates for the product, cart and checkout, and for the “Add to cart” action specify your site's JS function.

    What you get. The button on the product card in the search window calls your site's cart.

    What won't happen. Without the function, the button is shown but does nothing.

    What to do when the widget doesn't work as expected

    What you seeWhyWhat to do
    The widget didn't appear on the sitethe integration code isn't pasted, or isn't pasted into <head>check the code in the site template
    The widget is there but not in place of the search fieldthe CSS selector in the settings is wrongspecify the selector of exactly the element being replaced
    Search doesn't open on phonesthe mobile search button selector isn't setfill in the separate field for the mobile version
    The “Add to cart” button does nothingyour site's JS function isn't specifiedfill in the function code for this action
    Shoppers land on the wrong product pagethe link template is wrongcheck the product and category link templates

    FAQ

    How do I see the widget before adding it to my live site?

    Use the “Open demo site” button in the widget card. The results themselves are checked on the “Search test” tab — see how to set up search results.

    Will the code disappear from my site if I turn off smart search?

    No. The code in <head> is a line in your site template, and you remove it yourself. More: what disappears if you turn off smart search.

    Where do I change the store details used by search?

    In the company details: search takes them from there and updates them by itself. For other languages there's the “Texts for customers in other languages” block.

    How do I show results full-screen instead of under the search bar?

    Choose the full-screen window type instead of the one embedded under the search bar. More: how to show results.

    How do I stop results from rebuilding on every filter checkbox?

    Turn on “Apply filters with a button”: results rebuild when the shopper clicks the button.

    Where to find it and who has access

    Menu
    Directories → Categories → “Widget settings - Smart search” tile
    Access right
    the “Smart product search widget” window in group permissions
    Prepare
    access to your site template, to paste the code into <head>

    Related topics

    Was this article helpful?

    Missing a feature? Tell us.

    We will add it for free if other users need it too.

    If only you need it, we will agree on it separately.

    Article contents

    Suggest an improvement

    Try Elbuz free