harry1 Posted October 8, 2019 Share Posted October 8, 2019 Thank you for this sentq and for your assistance brian! 0 Quote Link to comment Share on other sites More sharing options...
sol2010 Posted February 19, 2020 Share Posted February 19, 2020 @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} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 20, 2020 Share Posted February 20, 2020 (edited) 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 February 20, 2020 by brian! 0 Quote Link to comment Share on other sites More sharing options...
ArianAmini Posted February 26, 2020 Share Posted February 26, 2020 hello @brian! In my country we dont use 00 at end on balance for example for 10.00 we use 10 how can i remove 00 from end of balance in this script? 0 Quote Link to comment Share on other sites More sharing options...
harry1 Posted February 27, 2020 Share Posted February 27, 2020 17 hours ago, ArianAmini said: hello @brian! In my country we dont use 00 at end on balance for example for 10.00 we use 10 how can i remove 00 from end of balance in this script? Use the PHP floor function https://www.php.net/manual/en/function.floor.php 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 27, 2020 Share Posted February 27, 2020 12 hours ago, harry1 said: Use the PHP floor function https://www.php.net/manual/en/function.floor.php 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. 🙄 0 Quote Link to comment Share on other sites More sharing options...
RpToR Posted April 30, 2020 Share Posted April 30, 2020 nice relase bro 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 26, 2020 Share Posted August 26, 2020 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. 😞 2 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 26, 2020 Author Share Posted August 26, 2020 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! 1 Quote Link to comment Share on other sites More sharing options...
ocastaned Posted November 30, 2020 Share Posted November 30, 2020 How can I make possible to show the "Available Credit" text into Spanish language? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 30, 2020 Share Posted November 30, 2020 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. 0 Quote Link to comment Share on other sites More sharing options...
ocastaned Posted November 30, 2020 Share Posted November 30, 2020 I don't know where I can see the hook version, but I am including this image to see if it helps: But I am pretty sure I installed it more than one year ago. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 1, 2020 Share Posted December 1, 2020 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>'); }); 1 Quote Link to comment Share on other sites More sharing options...
ocastaned Posted December 1, 2020 Share Posted December 1, 2020 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>'); }); It worked amazing! Thank you so much 🙂 0 Quote Link to comment Share on other sites More sharing options...
ROUTE AFRICA Posted January 16, 2021 Share Posted January 16, 2021 Thank you for awesome module 0 Quote Link to comment Share on other sites More sharing options...
CODEXINDIA Posted January 19, 2021 Share Posted January 19, 2021 I can't download the hook it's say its removed 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 20, 2021 Share Posted January 20, 2021 On 19/01/2021 at 10:32, SB SMART said: I can't download the hook it's say its removed there must be about 20 variations of the hook posted here in this thread - most of them will work. 0 Quote Link to comment Share on other sites More sharing options...
dbbrito Posted December 21, 2022 Share Posted December 21, 2022 Friends, is there a way to use this hook for the balance of another application? For example, I have a link https://example.com/getbalance/69823645 where the result would be: "Balance : 121.07" would you be able to show this result? Thanks and Regards 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.