Jump to content
Sign in to follow this  
sentq

Display Credit Balance In Six Template

Recommended Posts

On 10/7/2015 at 5:03 AM, sentq said:

Some people want to show their client's credit balance when they login to client area, as the option not implemented by default in Six Template here is how to do it:

1) Upload the PHP file from Attachements to -> /WHMCS-Path/includes/hooks/ directory.

WHMCS_SixTemplateCreditBalance.zip

SixTemplate-CreditBalance.png                https://prnt.sc/n52kxg

3

 

download.png

Share this post


Link to post
Share on other sites

now I love a good screenshot with red arrows just as much as the next guy, but what's the point you're trying to make ?

  • one invoice with a balance of 0.00 - perhaps you haven't marked it as paid ??
  • credit balance of $5 - it confirms the amount in the notifications...

also, you might want to look into your WHMCS license situation, it's invalid. headshake.gif

iS3tsv9.png

it might not have been the brightest of ideas to create an account here using your domain name (which btw is against the rules but seemingly never enforced) if you do not use a valid WHMCS license. 🙄

rN7GWsb.png

Share this post


Link to post
Share on other sites
11 hours ago, AlexBGames said:

Where does one upload the hook to?

Which directory in WHMCS cause hooks is not a vaild directory?

you need to upload it inside "{WHMCS-Main-Directory}/includes/hooks/" directory

Share this post


Link to post
Share on other sites

Just registered few days ago and found this treasure! Great hooks, installed right away when my client just about to ask about it few minutes ago!lol, thank you so much!!!

Share this post


Link to post
Share on other sites

its widget is showing on almost every pages on clint area, example product page, domain page, support page  etc, i need to show only on client area (homepage) and billing-related page, how its possible

Share this post


Link to post
Share on other sites
18 hours ago, HOSKIA INDIA said:

its widget is showing on almost every pages on client area, example product page, domain page, support page  etc, i need to show only on client area (homepage) and billing-related page, how its possible

the problem with this thread is that there are multiple versions of the same hook posted within it!

if you go back to page 2, I showed how you can make the sidebar only appear of specific pages.

Share this post


Link to post
Share on other sites

@brian!

Greetings. Thank you for your helpful contribution yet again.

Could you assist me to understand how best to show the info in the client email template?  I would make the email template in client area and send it when I see overpayment.

For example; customer makes an overpayment by using 1) credit card and 2) bank transfer

So it would be pertinent to write and tell them (amazing how many people pay twice and don't realise!)

 

Dear [carelessclientfirstname]

You have paid us twice, although we could spend it in the pub, we thought we'd advise you that:

  • Invoice #{$invoice_num} which was for a total of {$invoice_total} now has a balance of {$invoice_balance}
  • You've paid a total of {$invoice_amount_paid}, and the most recent payment was {$invoice_last_payment_amount} on {$invoice_date_paid}

^^^^^ that's all good....

This part I need help with because I want to show a list of transactions / payments made, along with the payment gateway, the amount and date - essentially allows client to understand why this error occured and probably not do it again.... 

{foreach from=$invoices item=invoice}   <<<<<<<< not sure about that
{$invoice_pay_method_type}: {$invoice_payment_method} {$invoice_last_payment_amount} on {$invoice_date_paid}
{/foreach}

 

 

Share this post


Link to post
Share on other sites

HI @sol2010

11 hours ago, sol2010 said:

This part I need help with because I want to show a list of transactions / payments made, along with the payment gateway, the amount and date - essentially allows client to understand why this error procured and probably not do it again.... 

{foreach from=$invoices item=invoice}   <<<<<<<< not sure about that
{$invoice_pay_method_type}: {$invoice_payment_method} {$invoice_last_payment_amount} on {$invoice_date_paid}
{/foreach}

the problem you have here is that an invoice email only has limited information for the current invoice - so there would be no $invoices array for you to loop through.

for an invoice with multiple transactions, the email template should have access to the last transaction details, but that's not enough for your purpose as you want details of all transactions.

therefore, you're going to need an EmailPreSend hook to pull those transaction details from the tblaccounts table for the specific invoice - in an EPS hook, and for an invoice-type template, the relid value would equal the invoice ID value... and that is the value you would use to search for in the table... probably, it would be useful for the hook to only return the transactions array if it finds more than one occurrence in its database query.

so that hook should give you a transactions array, and then it's just a case of looping through the array in the template and outputting as you want to.

Edited by brian!

Share this post


Link to post
Share on other sites
12 hours ago, harry1 said:

you wouldn't really need to do that, there was a bug in the original hook with regards to the handling of currencies that was easily solved... he PM'd and it was fixed within minutes.... the next day, his post is finally out of moderation. 🙄

Share this post


Link to post
Share on other sites
6 hours ago, JesusSuarz said:

I have published it here in case you want to see it

it might have been nice to include a mention of sentq as the original author in the code comments. 😞

Share this post


Link to post
Share on other sites
7 hours ago, JesusSuarz said:

I have made several modifications to the original, implement a couple of conditions to improve it.

I have published it here in case you want to see it: https://foroshosting.com/t/hook-para-agregar-bloque-de-saldo-al-area-de-cliente-de-whmcs.148/

It is in Spanish, however they can translate it, or add translation functions. 🙂

while I encourage and appreciate people contributions, its shame to see someone taking out the original contributor name, that is something I never understand!

Share this post


Link to post
Share on other sites
20 hours ago, sentq said:

while I encourage and appreciate people contributions, its shame to see someone taking out the original contributor name, that is something I never understand!

Hello, I apologize for the misunderstanding, you're right, I don't know why I took it off.

I have modified the theme and the code to add the real credits. I am very grateful to you.

Share this post


Link to post
Share on other sites
30 minutes ago, ocastaned said:

How can I make possible to show the  "Available Credit" text into Spanish language?

which version of the hook are you using? there is a Lang::trans version of it somewhere (not sure in this thread), where the users language is used for the output.

Share this post


Link to post
Share on other sites

I don't know where I can see the hook version, but I am including this image to see if it helps:

f7j5x6.png

But I am pretty sure I installed it more than one year ago.

 

 

Share this post


Link to post
Share on other sites
23 hours ago, ocastaned said:

But I am pretty sure I installed it more than one year ago.

try the following - pretty sure i've posted it before, but can't find the thread or specific post )might even be in this thread lol)...

<?php

use WHMCS\View\Menu\Item as MenuItem;
use WHMCS\Database\Capsule;

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

    $filename = basename($_SERVER['REQUEST_URI'], ".php");
    $parseFile = explode('.', $filename);
    $client = Menu::context("client");
    $clientid = intval($client->id);
    if ($parseFile['0']!=='clientarea' || $clientid===0){
        return;
    }
    $primarySidebar->addChild('Client-Balance', array('label' => Lang::trans('availcreditbal'), 'uri' => '#', 'order' => '1', 'icon' => 'fa-money'));
    $balancePanel = $primarySidebar->getChild('Client-Balance')->moveToBack()->setOrder(0);
    $balancePanel->addChild('balance-amount', array('uri' => 'clientarea.php?action=addfunds','label' => '<h4 style="text-align:center;">'.formatcurrency($client->credit,$client->currencyId).'</h4>','order' => 1));
    $balancePanel->setFooterHtml('<a href="clientarea.php?action=addfunds" class="btn btn-success btn-sm btn-block"><i class="fa fa-plus"></i> '.Lang::trans('addfunds').'</a>');
});

1K3tww5.pnga7bEFKK.png

Share this post


Link to post
Share on other sites
6 hours ago, brian! said:

try the following - pretty sure i've posted it before, but can't find the thread or specific post )might even be in this thread lol)...


<?php

use WHMCS\View\Menu\Item as MenuItem;
use WHMCS\Database\Capsule;

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

    $filename = basename($_SERVER['REQUEST_URI'], ".php");
    $parseFile = explode('.', $filename);
    $client = Menu::context("client");
    $clientid = intval($client->id);
    if ($parseFile['0']!=='clientarea' || $clientid===0){
        return;
    }
    $primarySidebar->addChild('Client-Balance', array('label' => Lang::trans('availcreditbal'), 'uri' => '#', 'order' => '1', 'icon' => 'fa-money'));
    $balancePanel = $primarySidebar->getChild('Client-Balance')->moveToBack()->setOrder(0);
    $balancePanel->addChild('balance-amount', array('uri' => 'clientarea.php?action=addfunds','label' => '<h4 style="text-align:center;">'.formatcurrency($client->credit,$client->currencyId).'</h4>','order' => 1));
    $balancePanel->setFooterHtml('<a href="clientarea.php?action=addfunds" class="btn btn-success btn-sm btn-block"><i class="fa fa-plus"></i> '.Lang::trans('addfunds').'</a>');
});

1K3tww5.pnga7bEFKK.png

 

It worked amazing! Thank you so much 🙂

Share this post


Link to post
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.

Sign in to follow this  

  • Similar Content

    • By WevrLabs
      AutoCredit for WHMCS is an addon that allows the automatic credit use setting to be optional per specific service/domain renewal invoices.
      By default, the setting in WHMCS is universal, if it is enabled, then all invoices generated upon cron job will have credit applied to them automatically from client's balance. The opposite when disabled, no credit will be applied when invoices are generated via cron.
      With AutoCredit addon, clients are able to selectively enable automatic credit use on renewal invoices of specific services/domains only.
      Version 2 Released:
      We are pleased to announce the release of version 2, which adds support for domains invoices (previous versions supported general product/service invoices only).

      https://dash.wevrlabs.net/cart.php?gid=6
      Addon Features:
      Allow clients to enable automatic credit usage on renewal invoices of specific services/domains only. Notify client when the credit applied to invoice is not enough to pay it. Display auto-credit status in services details page. Admin section to display clients list and the "Separate Invoices" option status for each client. Ability for admin to enable "Separate Invoices" option for new clients by default. Ability for admin to enable "Separate Invoices" option for all clients by one-click. Better track activities, by logging actions to activity log. Translation ready.  
    • By shanejen
      Hi 
       
      Could someone help me with the sidebar removal during  checkout/configuration and domain search ECT. I've managed to remove them with hooks and CSS, but I want the remaining content to fill the page and not be set to the right. There's too many out of date posts regarding this on here, and the WHMCS documentation is too vague. I'm using twenty-one template.
       
      TIA
    • By Dsbush
      So,I have an issue where some of my product groups in my sidebar are doubling up. I want to get rid of the doubles. What would be the best course of action that is not too complicated. 
    • By Tycho
      Hello,
      https://gyazo.com/ae7b45883641d2bbd26482f3233e7af2
      I want everything on the left side bar gone. What's the best way to do that without an empty spot? So I want to have the panels in the middle.
      I've looked at google a lot but couldn't get out anyway.
    • By stevelack
      I am trying to remove the sidebar menu "Actions" from the My Products and Services page.  I have created the following hook:
      ```
      <?php
      use WHMCS\View\Menu\Item as MenuItem;
      add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
      {
         if (!is_null($primarySidebar->getChild('My Services Actions'))) {
                  $primarySidebar->removeChild('My Services Actions');
         }    
      });
      ```
      But it is not removing the sidebar from the page /clientarea.php?action=services
      What am I doing wrong?
      Thanks,
      Steve
  • 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