Integrations / Platforms / Magento 1 (deprecated) / Autocomplete Menu Customization

Autocomplete Menu Customization

This integration and its documentation are deprecated and no longer supported.

The Algolia Search for Magento 1 extension is no longer supported (and Magento 1 has reached end of life). However, Algolia does offer a supported extension for Magento Open Source and Adobe Commerce.

This guide uses an outdated version of Autocomplete. Algolia recommends using Autocomplete v1 instead.

Algolia Shopify integration comes with v0. To migrate to v1, please refer to the upgrade guide.

Customize the autocomplete drop-down menu which appears underneath the search bar on your Magento site.

There are three folders involved in the drop-down menu customization:

  1. your-base-magento-folder/app/design/frontend/base/default/template/algoliasearch
  2. your-base-magento-folder/js/algoliasearch
  3. your-base-magento-folder/skin/frontend/base/default/algoliasearch

In the first one, you can find all the extension templates. In the others, you’ll find the extension’s JavaScript and style sheets.

Make sure you aren’t modifying but overriding these files. You can learn how to do that by reading “How to customize the extension” first.

Search box template

To change the search bar appearance, navigate to the templates directory and locate the autocomplete.phtml file. This file is the standard Magento template and is used only when you use the default (.algolia-search-input) search box selector.

To edit all templates used in autocomplete menu, navigate to the extension’s template folder and there to the autocomplete folder.

In there you will find the templates used to render the drop-down menu:

Customize the integration (JavaScript)

You can adjust all the logic of the autocomplete.js by using the events provided by our plugin. The plugin calls your custom logic at the right moment.

You can use the events to modify data sources and options. These hooks are triggered right before the autocomplete feature initializes.

Example of the hooks:

1
2
3
4
5
6
7
8
9
algolia.registerHook('beforeAutocompleteSources', function(sources, algoliaClient, algoliaBundle) {
  // Modify default sources, then return them
  return sources;
});

algolia.registerHook('beforeAutocompleteOptions', function(options) {
  // Modify default options, then return them
  return options;
});

Look & feel

The extension provides default CSS rules which are located in the algoliasearch.css file in the extension’s CSS folder.

You can easily override existing rules or add your own in your custom CSS theme file.

Did you find this page helpful?