Skip to main content
The suggest layer shows search suggestions while the visitor types. It queries FACT-Finder directly, independently of the search results page. This page contains the templates for it in both variants.
The direct integration is deprecated and no longer supported. It is only available up to FACT-Finder 6.9 and is neither maintained nor developed further by WEBSALE. For new integrations, use the FACT-Finder WebComponents according to the official FACT-Finder documentation.This page is intended for existing shops that still work with the direct integration.
Guide: FACT-Finder integration · Materials: FACT-Finder templates

Two variants

Both use the same CSS class names for the rows, but the stylesheets are not interchangeable. The simple layer builds a table, the extended one builds lists in two columns.

The simple suggest layer

ff_suggest.js

The file defines a constructor FFSuggest. You create an instance and call init() with eight parameters.
instanceName must exactly match the name of the variable under which you created the instance. The module inserts this name as text into the generated onMouseOver and onMouseDown attributes. If it doesn’t match, the layer stays silent without any error message.
The module doesn’t query FACT-Finder on every keystroke. It first compares with the last request and skips search terms longer than 50 characters entirely.The response is plain text: one line per suggestion, containing three fields separated by ### in the order suggestion, hit count, type. In the generated HTML they appear in the order suggestion, type, hit count.
The heading “Vorschläge zu Ihrer Suche…” is hard-coded in the JavaScript. If your shop is multilingual, extract this text and pass it in from outside.

ff_suggest.css

The values for top and left on div.suggestLayer are tailored to a specific shop design. Adjust them to your header, or position the layer relative to the search field.

The extended suggest layer

The extended layer splits the suggestions into two columns: product suggestions with images on the left, the remaining search terms on the right. It requires jQuery, fetches the suggestions via JSONP, and responds to more keys.

Which version you need

The previous documentation provides four files, one for each combination of jQuery version and FACT-Finder version. Together they differ in thirteen lines. This page therefore shows one version and describes the two deviations. Check with Omikron which FACT-Finder version you use.

The deviation for jQuery 2

jQuery 3 removed .error(). The template therefore uses .fail(). For jQuery 2, change this one line at the end of getSuggestions() back:

The deviation for FACT-Finder 6.10

As of 6.10, FACT-Finder no longer returns the suggestions as a bare array but wraps them in an object with the property suggestions. The previous documentation solves this with a separate file in which every use of jsonObj is replaced by pSuggest. There’s a simpler way. In the response function of getSuggestions(), add one line directly after pCurrentSelection = -1;:
After that, jsonObj is the array of suggestions in both FACT-Finder versions, and the rest of the file remains unchanged.
This consolidation was added here and hasn’t been tested in any shop. It follows from comparing the two original files, whose only substantive difference is this unwrapping. Test it in a test shop before you adopt it.At one point, the original file for 6.10 contains pSuggest[i] = pSuggest[i];, an assignment with no effect. It came about during renaming from pSuggest[i] = jsonObj[i]; and is further evidence that the four files were derived from each other mechanically.

The parameters of init()

Here init() takes fourteen parameters instead of eight. The first eight are the same as for the simple layer.
sid, uid, and site are only appended if they are filled. They end up both in the suggest request and in the target link that a clicked suggestion opens. FACT-Finder evaluates them for its statistics.

The translation object

Unlike the simple layer, the extended one contains no hard-coded texts. It expects them in the translation parameter: If a heading is missing, the module uses the technical type name. This was added here; the previous documentation doesn’t describe the parameter.

The callback functions

Three of them are global functions that you simply define. You pass the fourth to init().
displayElementCallback runs with a delay; the module defers each call by ten milliseconds. So don’t rely on the layer still being visible inside it.With onSubmitSuggest, you attach your own target pages to suggestions, for example to send a category suggestion directly to the category page instead of to the search.

The classes the module expects

The module inserts these classes into the generated HTML itself. Your stylesheet must define them.

ff_big_suggest.css

This stylesheet comes from a specific shop design. The fixed widths of 988, 670, and 242 pixels, the selector #head_search, and the background image navi_level_2.gif only fit there. Use it as a scaffold, not as a finished design..suggestParentCategory is set to display: none. So the module does deliver the parent category of a product suggestion; the example merely hides it. Remove the rule if you want to show it.

Where to get ff_big_suggest.js

The file itself isn’t printed here. It’s 509 lines long and consists almost entirely of flow logic that you adopt unchanged: keyboard control, building and tearing down the layer, assembling the links. Everything you configure in it is described above on this page. For the two deviations for jQuery 2 and FACT-Finder 6.10, change one line each, as described above.
If you don’t have the file at hand, ask WEBSALE. Since the direct integration is no longer being developed, it won’t change anymore.

What both variants have in common

Both expect a search form with a name and an empty div for the layer. Both attach to the input field, not to a button. And both offer a function you can use to close the layer from outside:
You need this if your shop should close the layer when the visitor clicks elsewhere, for example when opening the shopping cart preview.
Compared to the previous documentation, five spots in the listings have been corrected: an inverted error check that would have accessed a property of undefined in case of an error, the selection being preset to 0 instead of -1, the deprecated escape(), a missing semicolon, and “calback” instead of “callback” in two places.