Recent searches


No recent searches

Add multilingual welcome note (placeholder text) in search box along with user name



Posted Apr 17, 2017

[Following tip was posted as comment here; we think, this tip deserves it's own post]

Prerequisite: Zendesk Professional, or onwards subscriptions plan

Question: What I am going to get out of this tip?

Answer: If you want to show a welcome note (f.ex. "Hi Tom, how can we help?") in search-box (see image below), and let's say you want that to show in multiple languages?

Tip shared below would allow you to have multilingual welcome-note in search-box.

 

Please follow steps below:

  • Create Dynamic Content called "hc_search_greetings_template"
  • Store a string like, "Hello %NAME%, how can we help you?" in in "hc_search_greetings_template"
  • Add more variants (languages) but let's keep %NAME% in string where we want Name to appear"
  • Add a span tag with data-* attribute (following line of code) in Header template (at the end, after </header> line)
    <span id="dc_greetings_template" 
    data-value="{{dc 'hc_search_greetings_template'}}"
    style="display:none">
    </span>
  • Let's modify our code and place it any where in Theme JavaScript (General > Customize Design > Edit Theme > JS)
    $(document).ready(function() {
    if(HelpCenter.user.role!='anonymous') {
    var gtext = $("span#dc_greetings_template").data('value');
    gtext = gtext.replace('%NAME%', HelpCenter.user.name);
    $('#query').attr('placeholder', gtext);
    }
    });

 

Please try it, and share your feedback. I hope, it helps you. Have any questions, please get in touch.

 Cheers

Team Diziana 

Visit Diziana to download free and premium custom responsive ready-to-use Zendesk theme or Zendesk template or Zendesk plugins for Zendesk Help Center. Brand your Zendesk Help Center, and provide fantastic self-service customer support experience.

 


0

5

5 comments

image avatar

Jennifer Rowe

Zendesk Documentation Team

You're right--it does deserve its own post.

Thanks, Team Diziana!

0


@Jennifer Thank you :-)

 

Team Diziana 

Visit Diziana to download free and premium custom responsive ready-to-use Zendesk theme or Zendesk template or Zendesk plugins for Zendesk Help Center. Brand your Zendesk Help Center, and provide fantastic self-service customer support experience.

0


Thanks a lot! Worked as a charm!

0


image avatar

Jessie Schutz

Zendesk Customer Care

Hi Karol! I'm so glad this tip worked for you! Please let us know if you need anything else. :)

0


Is this still relevant in 2022? I know there were changes to ZD so I wonder if these instructions should work or not.
I followed the instructions step by step but nothing changed.

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post