Jump to content

Client home page "active" services total.


Chris74

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by twhiting9275
Link to comment
Share on other sites

<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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated