# Frequently asked questions for Joomla!

The following questions are the Frequently asked questions for Joomla! about XT Search for Algolia.

# How can I add the category field to the Instant Search results?

On Algolia Dashboard, you can find all fields that are stored in the Index. The fields can be used for the search queries and for front-end search widgets on the sites.

Algolia Configuration: The first step to add the category to the Instant Search widget is adding the "category_name" field to the list of retrievable fields on Algolia (Index/ Configuration/ Search Behaviour/ Retrieved attributes). In this way, you can control which fields are included in the search results (regardless if the search query is run on them).

XT Search Module Override: Now, it is time to configure the module view layout override on Joomla!. For more information about what are the module overrides. Please, check the following documentation: Understanding Output Overrides (opens new window)

XT Search comes with several alternative layouts that can be selected in the module configuration:

  • default-bs2.php, layout for Bootstrap 2
  • default-bs3.php, layout for Bootstrap 2
  • gantry.php, layout for Gantry

To add the "category_name" field, clone one of the basic layouts. For instance, save default-bs2.php as my-layout.php.

The layout includes the definition where each element is going to be displayed and the templates to render the content. Particularly, since we are customizing the search results template, this line of code must be commented to remove the default template:

To define the new hit template, it must be defined under the commented line in this way:

The template syntax is based on the mustache template engine (opens new window).

Finally, select the new module layout in the module configuration to render the search results with the new view that includes the category in the search results.

# How can I add the category field to the Autocomplete results?

This case is a similar case to the previous FAQ. In this case, since the Autocomplete has only a line or two lines to show the additional fields, only a simple template can be configured in the module layout override.

As an example, we have configured the following script in the module override of our demo site.

The templatesAutocompleteSuggestion function receives as parameters the title of the search results name, the image tag imageHtmlTag and the full search result suggestion; and then it returns a template that renders the basic template with or without a second line. In the second line, the publishing date and the category are included.

# How can we change the date format?

This is the current format: COM_XTDIR4ALG_USER_DATE_TIME_FORMAT="EEEE, MMMM d, yyyy HH:mm"

You can override the definition in the "Languages: Overrides".

The pattern is defined following these Date and time formatters: ICU User Guide / Formatting Dates and Times Overview (opens new window)

# How can we override the default search widget script?

By default, the scripts are distributed in the library media files directory: media/lib_xtdir4alg/app/js.

Then, following Joomla! overriding practices, you can copy the files to your template folder and change them there. For instance: templates/my-template/js/lib_xtdir4alg/app/instantsearch.min.js

# Installation Services

Save your time and focus on your business

Besides the general configuration, we complete the process according to the search configuration, in particular:

  • Check Configuration of Instant Auto-complete and search.
  • Check Adaptation and styling of the Instant Auto-complete and search to the store template.
  • Check Unlimited number of indexes, languages and products included.
  • Check Average project duration: 7-10 work days.

To know more about the installation services, click here: https://www.extly.com/xt-search-for-algolia.html#Installation-Service (opens new window)

Last Updated: 4/16/2024, 4:44:17 PM