sentq Posted October 2, 2015 Share Posted October 2, 2015 (edited) To activate the intelligent search to query results while typing instead of pressing the "Enter" key each time I have created simple ActionHook function that will integrate the code for both built-in template (v4 and Blend), the integration tested and is valid for WHMCS v6+ and v7+ 1) Create new PHP file inside /includes/hooks/ directory, you may use "IntelliSearchWhileTyping.php" as the file name or whatever you prefer. 2) Copy the following code inside it. 3) Done. <?php /** * Get Results From Intelligent Search While Typing * * Compatible with WHMCS v6+ and v7+ * Works with v4 and Blend templates * * @author SENTQ <development@sentq.com> * */ if (!defined("WHMCS")){ die("This file cannot be accessed directly"); } add_hook("AdminAreaHeadOutput", 1, function($vars){ # Template Blend if ($vars['template'] === "blend"){ return <<<EOF <script type="text/javascript"> /* Intelligent Search On Typing */ $(document).ready(function(){ $(document).on("input", "#intellisearchval", function(){ $("#intellisearchval").css("background-image","url('images/loading.gif')"); $.post("search.php", $("#frmintellisearch").serialize(), function(data){ $("#searchresultsscroller").html(data); $("#searchresults").slideDown("slow",function(){ $("#intellisearchval").css("background-image","url('images/icons/search.png')"); }); }); }); }); </script> EOF; } # Template v4 elseif ($vars['template'] === "v4"){ return <<<EOF <script type="text/javascript"> /* Intelligent Search On Typing */ $(document).ready(function(){ $(document).on("input", "#intellisearchval", function() { $.post("search.php", $("#frmintellisearch").serialize(), function(data){ if (data) { $("#searchresults").html(data); $("#btnIntelliSearch").hide(); $("#btnIntelliSearchCancel").removeClass('hidden').show(); $("#searchresults").hide().removeClass('hidden').slideDown(); } }); }); }); </script> EOF; } }); IntelliSearchWhileTyping.php Edited January 20, 2018 by sentq improvements and v7.1+ integration 0 Quote Link to comment Share on other sites More sharing options...
Boss Posted October 3, 2015 Share Posted October 3, 2015 Thanks for that. Shame it does not work for the V4 templates. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 3, 2015 Author Share Posted October 3, 2015 Thanks for that. Shame it does not work for the V4 templates. Use the following code instead to apply the same functionality to v4 template: /* Intelligent Search On Typing */ $(document).ready(function(){ $("#intellisearchval").on("keyup", function() { $.post("search.php", $("#frmintellisearch").serialize(), function(data){ if (data) { $("#searchresults").html(data); $("#btnIntelliSearch").hide(); $("#btnIntelliSearchCancel").removeClass('hidden').show(); $("#searchresults").hide().removeClass('hidden').slideDown(); } }); }); }); 0 Quote Link to comment Share on other sites More sharing options...
int Posted October 4, 2015 Share Posted October 4, 2015 This worked great, thanks for sharing! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 5, 2015 Author Share Posted October 5, 2015 This worked great, thanks for sharing! you're welcome 0 Quote Link to comment Share on other sites More sharing options...
Boss Posted October 6, 2015 Share Posted October 6, 2015 Love it. Thank you. much appreciated efforts. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 7, 2015 Author Share Posted October 7, 2015 Love it. Thank you. much appreciated efforts. You're welcome Boss 0 Quote Link to comment Share on other sites More sharing options...
Manchester Web Hosting Posted November 6, 2015 Share Posted November 6, 2015 Another great addition by @senqt 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted February 1, 2016 Share Posted February 1, 2016 Hi, are they still work-able ? because i add them at v 6.2.1,it seems un-working ? 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted February 1, 2016 Share Posted February 1, 2016 Hi,it works,it seems my browser make caching. thanks 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted January 20, 2018 Author Share Posted January 20, 2018 easier integration method added compatible with WHMCS v6+, v7+ 0 Quote Link to comment Share on other sites More sharing options...
alterman Posted January 22, 2018 Share Posted January 22, 2018 @sentq Hey there! As I see your new hook works great, however, I'm facing search window blinking on v4 template (seems like it's trying to search after each symbol inserted). Is it the same for you? 0 Quote Link to comment Share on other sites More sharing options...
edvancombr Posted September 28, 2018 Share Posted September 28, 2018 On 10/2/2015 at 10:36 AM, sentq said: To activate the intelligent search to query results while typing instead of pressing the "Enter" key each time I have created simple ActionHook function that will integrate the code for both built-in template (v4 and Blend), the integration tested and is valid for WHMCS v6+ and v7+ 1) Create new PHP file inside /includes/hooks/ directory, you may use "IntelliSearchWhileTyping.php" as the file name or whatever you prefer. 2) Copy the following code inside it. 3) Done. <?php /** * Get Results From Intelligent Search While Typing * * Compatible with WHMCS v6+ and v7+ * Works with v4 and Blend templates * * @author SENTQ <development@sentq.com> * */ if (!defined("WHMCS")){ die("This file cannot be accessed directly"); } add_hook("AdminAreaHeadOutput", 1, function($vars){ # Template Blend if ($vars['template'] === "blend"){ return <<<EOF <script type="text/javascript"> /* Intelligent Search On Typing */ $(document).ready(function(){ $(document).on("input", "#intellisearchval", function(){ $("#intellisearchval").css("background-image","url('images/loading.gif')"); $.post("search.php", $("#frmintellisearch").serialize(), function(data){ $("#searchresultsscroller").html(data); $("#searchresults").slideDown("slow",function(){ $("#intellisearchval").css("background-image","url('images/icons/search.png')"); }); }); }); }); </script> EOF; } # Template v4 elseif ($vars['template'] === "v4"){ return <<<EOF <script type="text/javascript"> /* Intelligent Search On Typing */ $(document).ready(function(){ $(document).on("input", "#intellisearchval", function() { $.post("search.php", $("#frmintellisearch").serialize(), function(data){ if (data) { $("#searchresults").html(data); $("#btnIntelliSearch").hide(); $("#btnIntelliSearchCancel").removeClass('hidden').show(); $("#searchresults").hide().removeClass('hidden').slideDown(); } }); }); }); </script> EOF; } }); IntelliSearchWhileTyping.php It appears to have crashed in the latest stable version of WHMCS (v7.6.1) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 28, 2018 Share Posted September 28, 2018 13 minutes ago, edvancombr said: It appears to have crashed in the latest stable version of WHMCS (v7.6.1) it works fine on my v7.6.1 dev using the Blend admin template. 0 Quote Link to comment Share on other sites More sharing options...
edvancombr Posted September 28, 2018 Share Posted September 28, 2018 Just now, brian! said: it works fine on my v7.6.1 dev using the Blend admin template. I cleared the browser cache and it worked again, thanks! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.