Chris74 Posted June 1, 2016 Share Posted June 1, 2016 I have the title "My Services" on this box and I don't like it displaying a zero, when the client may simply have an overdue plan to renew. They still have the service, but it is suspended. The way this is currently designed gives the impression that the service no longer exists. I want to make the total inside the box to display a single total of both active and suspended services. Currently it uses... <div class="stat">{$clientsstats.productsnumactive}</div> I've looked at the template variables and I can't find a way to quantify suspended services, in order to add these together. This must be possible because the total of suspended services is output on the sidebar in the clientareaproduct.tpl template. Unfortunately I'm not smart enough to work out how that is done. If it was a simple array value like the one above it would be easy, but it isn't. I'm sure it isn't complicated for someone who knows this stuff - perhaps someone could point me in the right direction? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 1, 2016 Share Posted June 1, 2016 change it to: <div class="stat">{$clientsstats.productsnumactive} ({$clientsstats.productsnumtotal})</div> it will display how many of services has in his account and how many of it are active 1 Quote Link to comment Share on other sites More sharing options...
Chris74 Posted June 2, 2016 Author Share Posted June 2, 2016 change it to: <div class="stat">{$clientsstats.productsnumactive} ({$clientsstats.productsnumtotal})</div> it will display how many of services has in his account and how many of it are active Thanks for your reply, but that will produce two numbers. I need one number that totals active services + suspended services. 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 2, 2016 Share Posted June 2, 2016 (edited) Thanks for your reply, but that will produce two numbers. I need one number that totals active services + suspended services. <div class="stat">{$clientsstats.productsnumtotal}</div> This will get the total list of services for the client. If you want to show them a list of suspended services, then <div class="stat">{$clientsstats.productsnumtotal} ({$clientsstats.productsnumtotal - $clientsstats.productsnumactive})</div> Edited June 2, 2016 by twhiting9275 0 Quote Link to comment Share on other sites More sharing options...
Chris74 Posted June 2, 2016 Author Share Posted June 2, 2016 <div class="stat">{$clientsstats.productsnumtotal}</div> This will get the total list of services for the client. If you want to show them a list of suspended services, then <div class="stat">{$clientsstats.productsnumtotal} ({$clientsstats.productsnumtotal - $clientsstats.productsnumactive})</div> Thanks, I do appreciate your reply, but unfortunately again that's not what I'm looking to do and also your info is incorrect. $clientsstats.productsnumtotal will also return the number of cancelled and terminated services. So subtracting active services from that number won't produce the number of suspended products. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 2, 2016 Share Posted June 2, 2016 create new PHP file inside /includes/hooks/ directory, put the following code inside it <?php use Illuminate\Database\Capsule\Manager as Capsule; use WHMCS\View\Menu\Item as MenuItem; add_hook("ClientAreaPage", 1, function($vars){ $client = Menu::context("client"); if (!is_null($client)){ $getServices = Capsule::table("tblhosting")->whereIn("domainstatus", array("Active", "Suspended"))->where("userid", $client->id)->count(); return array("clientstotalservices" => $getServices); } }); then use {$clientstotalservices} in your .tpl file where you need to display that number 2 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 2, 2016 Share Posted June 2, 2016 I was just about to post a near-identical hook... except I used ClientAreaPageHome hook instead... gurus think alike! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 2, 2016 Share Posted June 2, 2016 I was just about to post a near-identical hook... except I used ClientAreaPageHome hook instead... gurus think alike! Thank you I thought he might need to display it in multiple pages 0 Quote Link to comment Share on other sites More sharing options...
Chris74 Posted June 2, 2016 Author Share Posted June 2, 2016 Wow that's awesome - thank you so much! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 2, 2016 Share Posted June 2, 2016 Wow that's awesome - thank you so much! You're Welcome 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.