Gravatar for gaurav.bhatt@kpit.com

Question by gbhattkpit, Oct 2, 2018 6:49 PM

Where / how do I Add a custom message between "Cancel Last Action" & "Search Tips" when No results are displayed on Coveo for Sitecore 4.1 Hive

Where / how do I Add a custom message between "Cancel Last Action" & "Search Tips" when No results are displayed on Coveo for Sitecore 4.1 Hive.

I want to add a basic text message but I cant seem to find which layout / cshtml file I should add this message to?

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Oct 9, 2018 5:57 PM

The component fronted by Coveo for Sitecore Hive is QuerySummary, from the Coveo JavaScript Search Framework.

The options were added in the September `2.4609` release, so you first need to add this version in your Coveo Search Resources' data source, as seen here:

Once added, you can duplicate the `Coveo Query Summary` component, located in the `Views/Coveo Hive/Components` folder, into `Coveo Custom Message Summary`.

Add the following attributes in the file so that it looks like this:

@model Coveo.UI.Components.Models.Components.IQuerySummaryModel<span class="CoveoQuerySummary"
    data-no-results-found-message="No Results!"
     @foreach (var property in @Model.RawProperties) {
         @:data-@(property.Key)='@(property.Value)'
     }>
</span>

You can then duplicate the Rendering in Sitecore which allows you to add this rendering with the new file in the Search Interface:

----

If this does not meet your needs, you can also add hooks on some of the framework events and add some text using simple JavaScript code.

Ask a question