Use Search Word Used In Script

Hi,

Whenever there are no search results found, cs-cart displays text from language variable: text_no_matching_products_found

I added some JS script (amazon ads) to this variable and it works fine. If there are no search results it displays the amazon ads. However, I would like to use the search word used in the JS. Any idea how i can achieve this? I can get this using SMARTY {$smarty.request.q}

Thank you

You can add placeholder to the language variable (e.g. [SEARCHQUERY]) and display language variable in the following way:

{__('text_no_matching_products_found')|replace:"[SEARCHQUERY]":$smarty.request.q}

You can add placeholder to the language variable (e.g. [SEARCHQUERY]) and display language variable in the following way:

{__('text_no_matching_products_found')|replace:"[SEARCHQUERY]":$smarty.request.q}

Thanks for the response. Here's what I'm actually trying to do. The script works, but when i replace the search phrase with {$smarty.request.q} then it stops working.

{literal}
{/literal}

I am afraid, SMARTY code is not processed in the language variables. Try to use solution from post #2

I am afraid, SMARTY code is not processed in the language variables. Try to use solution from post #2

I misunderstood your post. I tried it and its working fine now. thanks!

We were glad to help you!