Blu_ Posted March 9, 2014 Share Posted March 9, 2014 Okay so basically im not sure if this is possible or not but i want my clients to know how many total clients there are in our WHMCS system... Is there a smarty syntax thing that displays the total number of clients we have? In number form. Please help, cant find anywhere! 0 Quote Link to comment Share on other sites More sharing options...
Blu_ Posted March 9, 2014 Author Share Posted March 9, 2014 I have found this.. I'm not sure how to use it with smarty though.. http://docs.whmcs.com/API:Get_Clients If you look at this screenshot http://prntscr.com/2zalei totalresults is what i need to display.. But i'm not sure how to display that using smarty can someone help me i found all the documentation just don't know how to execute 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 9, 2014 Share Posted March 9, 2014 there isn't a direct Smarty variable that you can use, so you will have to query the database to get these values and assign them to a variable... if you wanted to display the total number of clients, you could use the following in a template... {php} $counter = mysql_query("SELECT COUNT(*) AS id FROM tblclients"); $num = mysql_fetch_array($counter); $count = $num["id"]; $this->assign('clienttotal',$count); {/php} Then you can add the code below to where you want to display the number. {$clienttotal} in a similar way, you could show number of domains... {php} $counter2 = mysql_query("SELECT COUNT(*) AS id FROM tbldomains"); $num2 = mysql_fetch_array($counter2); $count2 = $num2["id"]; $this->assign('domaintotal',$count2); {/php} Then you can add the code below to where you want to display the result. {$domaintotal} this will show you the total number of domains in WHMCS, but will also include expired domains too... if you wanted to show only "Active" domains, you would replace the first line of the above with... {php} $counter2 = mysql_query("SELECT COUNT(*) AS id FROM tbldomains WHERE status='Active'"); $num2 = mysql_fetch_array($counter2); $count2 = $num2["id"]; $this->assign('domaintotal',$count2); {/php} similarly, you could show the number of active clients by using... $counter = mysql_query("SELECT COUNT(*) AS id FROM tblclients WHERE status='Active'"); for completeness, if you wanted to show number of products/services (hosting), you could use... {php} $counter3 = mysql_query("SELECT COUNT(*) AS id FROM tblhosting"); $num3 = mysql_fetch_array($counter3); $count3 = $num3["id"]; $this->assign('hostingtotal',$count3); {/php} or for active products only... $counter3 = mysql_query("SELECT COUNT(*) AS id FROM tblhosting WHERE domainstatus='Active'"); all three combined... {php} $counter = mysql_query("SELECT COUNT(*) AS id FROM tblclients WHERE status='Active'"); $num = mysql_fetch_array($counter); $count = $num["id"]; $this->assign('clienttotal',$count); $counter2 = mysql_query("SELECT COUNT(*) AS id FROM tbldomains WHERE status='Active'"); $num2 = mysql_fetch_array($counter2); $count2 = $num2["id"]; $this->assign('domaintotal',$count2); $counter3 = mysql_query("SELECT COUNT(*) AS id FROM tblhosting WHERE domainstatus='Active'"); $num3 = mysql_fetch_array($counter3); $count3 = $num3["id"]; $this->assign('hostingtotal',$count3); {/php} Number of Clients - {$clienttotal}<br> Number of Domains - {$domaintotal}<br> Number of Products - {$hostingtotal} 0 Quote Link to comment Share on other sites More sharing options...
Blu_ Posted March 9, 2014 Author Share Posted March 9, 2014 there isn't a direct Smarty variable that you can use, so you will have to query the database to get these values and assign them to a variable... if you wanted to display the total number of clients, you could use the following in a template... {php} $counter = mysql_query("SELECT COUNT(*) AS id FROM tblclients"); $num = mysql_fetch_array($counter); $count = $num["id"]; $this->assign('clienttotal',$count); {/php} Then you can add the code below to where you want to display the number. in a similar way, you could show number of domains... {php} $counter2 = mysql_query("SELECT COUNT(*) AS id FROM tbldomains"); $num2 = mysql_fetch_array($counter2); $count2 = $num2["id"]; $this->assign('domaintotal',$count2); {/php} Then you can add the code below to where you want to display the result. this will show you the total number of domains in WHMCS, but will also include expired domains too... if you wanted to show only "Active" domains, you would replace the first line of the above with... {php} $counter2 = mysql_query("SELECT COUNT(*) AS id FROM tbldomains WHERE status='Active'"); $num2 = mysql_fetch_array($counter2); $count2 = $num2["id"]; $this->assign('domaintotal',$count2); {/php} similarly, you could show the number of active clients by using... $counter = mysql_query("SELECT COUNT(*) AS id FROM tblclients WHERE status='Active'"); for completeness, if you wanted to show number of products/services (hosting), you could use... {php} $counter3 = mysql_query("SELECT COUNT(*) AS id FROM tblhosting"); $num3 = mysql_fetch_array($counter3); $count3 = $num3["id"]; $this->assign('hostingtotal',$count3); {/php} or for active products only... $counter3 = mysql_query("SELECT COUNT(*) AS id FROM tblhosting WHERE domainstatus='Active'"); all three combined... {php} $counter = mysql_query("SELECT COUNT(*) AS id FROM tblclients WHERE status='Active'"); $num = mysql_fetch_array($counter); $count = $num["id"]; $this->assign('clienttotal',$count); $counter2 = mysql_query("SELECT COUNT(*) AS id FROM tbldomains WHERE status='Active'"); $num2 = mysql_fetch_array($counter2); $count2 = $num2["id"]; $this->assign('domaintotal',$count2); $counter3 = mysql_query("SELECT COUNT(*) AS id FROM tblhosting WHERE domainstatus='Active'"); $num3 = mysql_fetch_array($counter3); $count3 = $num3["id"]; $this->assign('hostingtotal',$count3); {/php} Number of Clients - {$clienttotal}<br> Number of Domains - {$domaintotal}<br> Number of Products - {$hostingtotal} Thank you dude! This is exactly what i was looking for! Big props my good sir! This will come in handy to so many people who are having the same problem I have. 0 Quote Link to comment Share on other sites More sharing options...
hostingames Posted October 28, 2014 Share Posted October 28, 2014 good evening can add a command more the total number of customer site host thank you 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted October 28, 2014 Share Posted October 28, 2014 the total number of customer site host The example code does that (for where 1 hosting account = 1 site) if you only offer hosting products. 0 Quote Link to comment Share on other sites More sharing options...
hostingames Posted October 29, 2014 Share Posted October 29, 2014 good evening, I propose not to the client server dedicated cloud server and shared hosting and reseller plan because the code already present I lack dedicated server and cloud server reseller plan can you help me thank you 0 Quote Link to comment Share on other sites More sharing options...
hostingames Posted January 15, 2015 Share Posted January 15, 2015 hi, header.tpl on my page that works, by-against my index.html page that does not work rename it to index.php and replace {} with php <? php and {/ php} with?> a solution? thank you 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.