How to add Google custom search to magento

How to add Google custom search to magento

Rate this article

Share this article

The default Magento search is not up to your expectations? You are not alone. Fortunately, You can use Google custom search for free to add good search functionality to your Magento store.

The only issue is that Google custom search has ads. If you are looking for an ad-free Magento search experience, you could opt for Expertrec custom search engine (plans begin at 9 USD per month).

Quick answer: To add Google custom search to Magento, go to https://cse.google.com/cse/create/new, enter your Magento website URL, click create, then click “get code” and copy it. Replace the Magento search box code in form.mini.phtml with the Google code. Google custom search is free but shows ads; Expertrec plans begin at 9 USD per month.

Option Cost Ads
Google custom search Free Shows ads
Expertrec custom search Plans begin at 9 USD per month Ad-free

steps to create a Magento google custom search engine –

    1. Create the engine at cse.google.com

      Go to https://cse.google.com/cse/create/newmagento google custom search

    2. Enter your Magento website URL and click on create- magento google custom search
    3. Get the embed code

      Click on “get code”.magento google custom search

    4. Copy the code-magento google custom search
    5. Replace the Magento search box code

      Replace the Magento search box code with Google custom search box code. For this step, you might need the help of your developer. The template for Magento search box can be found at app/design/frontend/base/default/template/catalogsearch/form.mini.phtml. We will change this so it will call the google search code. Change this from:

      Original Magento form.mini.phtml

      <form id="search_mini_form" action="" method="get">
       <div class="form-search">
       <label for="search"> __('Search:') ?> </label>
       <input id="search" class="input-text" name="" type="text" value="">
       <button class="button" title=""> 
      <span> 
      <span> __('Search') ?> </span>
       </span>
       </button> 
      <script type="text/javascript">
      </script>
      </div>
      </form>

      to the code that you copied from Google custom search control panel

    6. That’s it! you have added google custom search to your Magento store. Here are some screenshots of the search user interface which you can further change from your control panel. Here is a demo link built on the data of cosjj ( a Magento store).magento google custom search

Add a Search Bar to Magento

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like