Customize No Results Banner Text

Hi Team,

My client would like to update the copy in the vertical no results banner for a couple of verticals. See the screenshot attached, they’d like to update the copy in the green banner to the below for their funeral homes vertical.

"Sorry, we could not find any funeral homes in that location. Please try again using a full postcode in the format “B73 6AP.”

How would I go about making this change for them? Is it possible to override the theme and update the no results copy for a couple of verticals, whilst keeping the rest as is? Thanks.

1 Like

Hi Scott,

This Community post should help!

Hi @Kristy_Huang,

Thanks for your response but that’s not quite what I’m looking for. The post you linked suggests adding "template": into the "VerticalResults" object within my vertical’s “config.json” file but that doesn’t work exactly how my client is expecting.

By taking this approach the raw text shows in place of the existing no results banner (see screenshot), but there is no styling and we lose a lot of the standard banner’s core functionality, such as linking to other verticals and universal. How can I simply update the text within the green bar of the existing no results banner but still keep all of the other functionality? Is that possible? Thanks.

1 Like

Hi Scott,

Here’s how you would customize the full no results template, beyond just adding a string as Kristy mentioned:

  1. In your partials directory, create a new partial – we’ll call it alternative-verticals-override.hbs. Copy over the contents of the alternative verticals template found here. Modify the template as needed.

  2. Via the Jambo override command, shadow templates/[[layout-name]]/script/verticalresults.hbs. At the end of the file, add the following

{
  noResults: Object.assign(
    {}, 
    {{{ json componentSettings.VerticalResults.noResults }}},
    {
      template: `{{{read 'partials/alternative-verticals-override'}}}`,
    }
  ), 
}

The full file should look like this:

ANSWERS.addComponent('VerticalResults', Object.assign({}, {
  container: '.js-answersVerticalResults',
  {{#if verticalKey}}
    verticalKey: '{{{verticalKey}}}',
    modifier: '{{{verticalKey}}}',
  {{/if}} 
  verticalPages: [
    {{#each verticalConfigs}}
      {{#if verticalKey}}
      {
        verticalKey: '{{{verticalKey}}}',
        {{#each ../excludedVerticals}}{{#ifeq this ../verticalKey}}hideInNavigation: true,{{/ifeq}}{{/each}}
        {{#ifeq ../verticalKey verticalKey}}isActive: true,{{/ifeq}}
        {{#with (lookup verticalsToConfig verticalKey)}}
        {{#if isFirst}}isFirst: {{isFirst}},{{/if}}
        {{#if icon}}icon: '{{{icon}}}',{{/if}}
        {{#if iconUrl}}iconUrl: '{{{iconUrl}}}',{{/if}}
        label:
        {{#if label}}'{{{label}}}'{{else}}{{#if ../verticalKey}}'{{{../verticalKey}}}'{{else}}'{{{@key}}}'{{/if}}{{/if}},
        url: {{#if url}}'{{{url}}}'{{else}}'{{{@key}}}.html'{{/if}},
        {{/with}}
      }{{#unless @last}},{{/unless}}
      {{else}}
      {
      {{#with (lookup verticalsToConfig 'Universal')}}
        {{#if isFirst}}isFirst: {{isFirst}},{{/if}}
        {{#if icon}}icon: '{{{icon}}}',{{/if}}
        label: {{#if label}}'{{{label}}}'{{else}}'{{{@key}}}'{{/if}},
        url: {{#if url}}'{{{url}}}'{{else}}'{{{@key}}}.html'{{/if}}
      {{/with}}
      }{{#unless @last}},{{/unless}}
      {{/if}}
    {{/each}}
  ],
  {{#with (lookup verticalsToConfig verticalKey)}}
    card: {
      {{#if cardType}}cardType: '{{{cardType}}}',{{/if}}
    }
  {{/with}},
}, 
{{{ json componentSettings.VerticalResults }}},
{
  noResults: Object.assign(
    {}, 
    {{{ json componentSettings.VerticalResults.noResults }}},
    {
      template: `{{{read 'partials/alternative-verticals-override''}}}`,
    }
  ), 
}
));

The no results template can be customized per vertical layout (so each vertical-standard will get the same no results template). It sounds like you just need this for a vertical with maps, and assuming there’s only one, it might do the trick; however, you can also use conditionals in the handlebars to display specific messaging per vertical. This gets a little more advanced (you’d likely need a helper method to do the comparison), but we can provide additional instruction if needed.

Thanks,
Rose

3 Likes

Hi! Thanks for this post. I have followed the instructions, but the banner is super wonky. Is there something different I need to do since this experience is in German? Trying to make a very small tweak to the language per a client request.

@Kristy_Huang

Continuing the discussion from Update No Results Banner:

Hi Community,
Thanks for this post. I have noticed a problem related to this “no result banner”.
I have an incorrect part of the templated translation in a French experience, and I guess other languages could be impacted too.
In this banner, a word was left in English (“in”) in the verticals no results:


The correct word in French instead of “in” would be “dans”.
Is this a modification that could be done and applied to all French Experiences (and maybe other languages if the problem is the same)?

Thanks in advance for your feedback.

Hi!

I am currently experiencing an issue where I have added an updated no results partial according to these instructions, but now both the original and the modified banners are showing in the experience. Any idea what might be causing this?
(cc: @Alyssa_Hubbard)

Thanks in advance!
Sherman

Hi Sherman,

Overriding the no results template for the vertical-full-page-map layout is slightly different than other components, since the Map component lives entirely in the theme. To override, shadow theme-components/vertical-full-page-map-alternative-verticals/alternativeverticals.hbs and make any adjustments there.

Thanks!
Rose

Hi @roser @Kristy_Huang , first thank you for the answers on this post–it was very helpful! I followed @roser 's instructions on overriding the full no results template which worked well–my one issue is that on both the IT and EN locales it now only shows the IT translations. How can I tweak it so that it shows the original EN translations on the EN locale? Thanks!

Hi @Stephen_Read ! The issue here was related to the fallback. Indeed, Italian was set as fallback for the English locale. By default, the fixed text in the components will be in English. By specifying a fallback locale, the Italian translations are being used instead because there is no en.po file with English translations found. In the case of English, the translation file is not needed, so not specifying a fallback will automatically use English as the default.

We applied the change to the account and it’s working now!

Best,

Federica