Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Use Search Word Used In Script Rate Topic   - - - - -

 
  • buging
  • Member
  • Members
  • Join Date: 12-Jan 11
  • 332 posts

Posted 09 October 2016 - 03:55 AM #1

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

 

 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19057 posts

Posted 10 October 2016 - 07:10 AM #2

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}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • buging
  • Member
  • Members
  • Join Date: 12-Jan 11
  • 332 posts

Posted 11 October 2016 - 02:38 AM #3

 

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}
<script type="text/javascript">
amzn_assoc_search_bar = "true";
amzn_assoc_tracking_id = "xxxxx;
amzn_assoc_search_bar_position = "top";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_title = "Search Results from Amazon";
amzn_assoc_default_search_phrase = '{/literal}{$smarty.request.q}{literal}';
</script>
{/literal}


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19057 posts

Posted 11 October 2016 - 06:41 AM #4

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


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • buging
  • Member
  • Members
  • Join Date: 12-Jan 11
  • 332 posts

Posted 11 October 2016 - 11:07 AM #5

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!



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19057 posts

Posted 11 October 2016 - 01:27 PM #6

We were glad to help you!


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.