Developer forum

Forum » Templates » instant search variants

instant search variants


Reply
Hi,

Is it possible to only get the "main products" in the instant search results, instead of all the variants by default?

The lists Im getting are quite long displaying all the variants of a product, which is not that great.

Regin Madsen
Haug-IT ApS

Replies

 
Reply
Hello,

There is no built-in functionality that allows you not to retrieve (populate) the specified search result but you can hide it from the user instead:

First open your template containing the Javascript block which initializes an Instant Search functionality (either one of these three standard templates: "/Files/Templates/eCom/Search/SearchFormAdvanced.html", "/Files/Templates/eCom/Search/SearchFormSuggestions.html" or "/Files/Templates/Filter/TextFilterAdvanced.html" depending on how you implemented your Instant Search functionality).

Now find the line starting with Dynamicweb.Frontend.InstantSearch.setEnableSuggestions and modify onItemDataBound method as the following:

onItemDataBound: function(sender, args) {
    if (args.data.VariantID) {
        // Hiding the search result if the VariantID property is not empty    
        Dynamicweb.Frontend.Document.Current.style(args.template.get_container(), {display: 'none'});
    } else {
        // The rest of the method
}

Hope this will help you.

-- Pavel
 
Reply
Hi,

Sorry I didnt reply.

Yes this works like a charm.

I have now been testing it for a few weeks on a solution under development, and to be honest; Instant search is not actually what it is!

The good stuff: when you have been getting the first response, and cahnge your query its ok fast.

BUT - and this is not good - when you start entering some text you get delays of severral seconds before anything shows up. Actually it most times are so slow that a regular user could type the request and hit search before the "instant search" result are returned...
Of cause we could set up a sign saying "please wait while instant search are getting back with the result" - but thats not the idea right ;-)

Feel free to mail me regarding the solution in question if you want to do some testing.

Regin Madsen
Haug-IT ApS

 

You must be logged in to post in the forum