Jump to content

Display Credit Balance In Six Template


sentq

Recommended Posts

How do I get it to show the credit balance only in the billing section?

you could modify the hook code and change...

 

    $filename = APP::getCurrentFileName();

   $client = Menu::context("client");

   $clientid = (int) $client->id;

   if ($filename!=='clientarea' || $clientid===0){
       return;
   }

to...

 

    $filename = APP::getCurrentFileName();
   $action = $_GET['action'];
   $allowed = array('invoices', 'quotes', 'masspay', 'addfunds');
   $client = Menu::context("client");

   $clientid = (int) $client->id;

   if ($filename!=='clientarea' || $clientid===0 || !in_array($action,$allowed)){
       return;
   }

if you do this, then the credit balance sidebar will only show on the invoice, quotes, masspay and addfunds pages.

Link to comment
Share on other sites

you could modify the hook code and change...

 

if you do this, then the credit balance sidebar will only show on the invoice, quotes, masspay and addfunds pages.

 

Oh excellent, thanks so much! Is that how that is done, great! Obviously I haven't spent much time

coding in the WHMCS environment. I was also able to put a conditional for the credit balance so it

only shows if the balance is above zero!

 

If anyone needs that my final is this, the balance also shows on the main/home page as well but not on

non billing related pages:

 

  add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $primarySidebar){

   $filename = APP::getCurrentFileName();

   $client = Menu::context("client");

   $clientid = (int) $client->id;
   $action = $_GET['action'];
   $allowed = array('invoices', 'quotes', 'masspay', 'addfunds','');

   if ($filename!=='clientarea' || $clientid===0 || !in_array($action,$allowed)){
       return;
   }
   if ($client->credit <= 0.00) { return; }

 

Thanks again brian! !!!

Edited by rkatz0
Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...
  • 1 month later...

For this issue permanent solution is

 

http://forums.whmcs.com/showthread.php?114126-Six-template-Small-Layout-Issue-Fix&p=462390#post462390

 

 

 

 

Thank you! hook works insanely well...

 

Found one issue, when in "Portal Home / Client Area / My Invoices" the Secondary_Sidebar-Billing module glitches out from the sidebar. Sorry not very familiar, learning whmcs as I go along. (See screenshot) Is there an easy fix to this?

 

Thanks in advance...

 

Once again Great Hook!!!

 

[ATTACH=CONFIG]9667[/ATTACH]

Link to comment
Share on other sites

Just for those wanting this module with the last modification without having to sort out the modification I've attached a copy.

 

I didn't code this or change it beyond including the modifications found in this thread already. I.e. I will not provide support :).

it will be displayed in the following pages only if client already has credit:

Home Page - My Invoices - My Quotes - Mass Payment - Add Funds

 

@MikeDVB thanks for sharing

Link to comment
Share on other sites

  • 5 months later...
  • 3 weeks later...
  • 2 months later...
  • 3 weeks later...
  • 1 month later...

Hello,

 

I just want to fix the bug that when someone try to verify his email address when he's already logged in, he gets the balance in the login page.

 

...

if ($filename!=='clientarea' || $clientid===0 || strpos($_SERVER['REQUEST_URI'], 'verificationId') !== false) {
   return;
}

...

 

Regards,

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 4 weeks later...
  • 3 weeks later...

This is great, really! Thank you for adding it.

 

However there is a problem on my installation where the "Actions" block are not aligned with the other blocks on the left side. Instead, it goes to the contents area. This happens for example when we open the EPP code page, but not all pages. Please see the screenshot: http://dns.d.pr/opM4Ex/ao4i5Lg9

 

Is there a way to fix this?

 

Thank you

Link to comment
Share on other sites

This is great, really! Thank you for adding it.

 

However there is a problem on my installation where the "Actions" block are not aligned with the other blocks on the left side. Instead, it goes to the contents area. This happens for example when we open the EPP code page, but not all pages. Please see the screenshot: http://dns.d.pr/opM4Ex/ao4i5Lg9

 

Is there a way to fix this?

 

Thank you

Hi,

 

Thank you :)

 

the issue is common with Template Six, here is the way to fix it: https://forum.whmcs.com/showthread.php?106891-Display-Credit-Balance-In-Six-Template&p=448314#post448314

Link to comment
Share on other sites

Hi,

 

Thank you :)

 

the issue is common with Template Six, here is the way to fix it: https://forum.whmcs.com/showthread.php?106891-Display-Credit-Balance-In-Six-Template&p=448314#post448314

 

Superb, it worked :)

 

Now, my store does not allow customers to Add Funds but the button to add funds is visible. Is it possible to remove the button and just display the existing credit (i.e. from refunds or manually added by us)? A php condition would be great, in case we enable the add funds in the future.

 

Thank you once again.

Link to comment
Share on other sites

Now, my store does not allow customers to Add Funds but the button to add funds is visible. Is it possible to remove the button and just display the existing credit (i.e. from refunds or manually added by us)?

to remove it permanently, just remove the footer code from the hook...

    $balancePanel->setFooterHtml(
       '<a href="clientarea.php?action=addfunds" class="btn btn-success btn-sm btn-block">
           <i class="fa fa-plus"></i> '.Lang::trans('Add Funds').'
       </a>'
   );

A php condition would be great, in case we enable the add funds in the future.

to make the footer conditional on the add funds feature being enabled, just wrap it in an if statement - there'd be a few ways to do that, checking the $CONFIG array would be the simplest, but as sentq is already using Capsule, we'll go down that route...

    $fundsenabled = Capsule::table('tblconfiguration')->where('setting','AddFundsEnabled')->value('value');

   if ($fundsenabled == "on") {

       $balancePanel->setFooterHtml(
           '<a href="clientarea.php?action=addfunds" class="btn btn-success btn-sm btn-block">
               <i class="fa fa-plus"></i> '.Lang::trans('Add Funds').'</a>'
       );
   }

if using WHMCS v6, you may need to change ->value('value') to ->pluck('value').

Link to comment
Share on other sites

Just tried the conditional version, worked perfectly fine :)

The only thing missing is the link that it is still active on the "Available Credit" box but it is not a big problem for me. It is ok as it is.

you could remove the code below and that would remove the link...

'uri' => 'clientarea.php?action=addfunds',

if add funds is enabled, then the client can use the button link in the footer... if it's not enabled, the above link is irrelevant! :)

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.

×
×
  • 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