andrezzz Posted January 2, 2022 Share Posted January 2, 2022 2 minutes ago, TimRef said: seems the hook page is Loaded , but not working . on page /clientarea.php?action=invoices . not showing anything . its a blank page . The hook is fine, will only be triggered once the Invoice is Created, I already use it on my personal Hosting Website. 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 2, 2022 Author Share Posted January 2, 2022 3 minutes ago, andrezzz said: Do you have this two enabled? All enabled , also enabled Hooks Debug. 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 2, 2022 Author Share Posted January 2, 2022 4 minutes ago, andrezzz said: The hook is fine, will only be triggered once the Invoice is Created, I already use it on my personal Hosting Website. the issue is : the invoice page is not shown now , only leave a blank. not sure why . I will check myself , thanks for your you guy's help .thanks . 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 6, 2022 Author Share Posted January 6, 2022 On 12/29/2021 at 8:25 PM, andrezzz said: Hello, Maybe we can manage a way, using a Hook file, interested in this? Hi, andrezzz, and @pRieStaKos thanks for your help . Can I ask you another question . In this topic , what I need to do is to show dedicated Ip or hostname on clientareainvoices.tpl page . like this photo in attachment . Do you have any idear to do this ? and will the hook working for this ? 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 6, 2022 Author Share Posted January 6, 2022 Just now, TimRef said: Hi, andrezzz, and @pRieStaKos thanks for your help . Can I ask you another question . In this topic , what I need to do is to show dedicated Ip or hostname on clientareainvoices.tpl page . like this photo in attachment . Do you have any idear to do this ? and will the hook working for this ? Maybe this need to change something like dataTables.bootstrap.min.js or other js using https://datatables.net/ ? will the hook working for this ? 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 6, 2022 Share Posted January 6, 2022 3 hours ago, TimRef said: Maybe this need to change something like dataTables.bootstrap.min.js or other js using https://datatables.net/ ? will the hook working for this ? Just…don’t. Check this and pass the ip to the table 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 6, 2022 Author Share Posted January 6, 2022 4 hours ago, pRieStaKos said: Just…don’t. Check this and pass the ip to the table OK , thanks @pRiestaKos . will try and update . so happy to get reply . 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 7, 2022 Author Share Posted January 7, 2022 8 hours ago, pRieStaKos said: Just…don’t. Check this and pass the ip to the table Hi, @pRieStaKos sorry for another question , the clientareainvoices.tpl file use the mysql table ‘tblinvoices’ , and in that table have no 'hostname' or 'dedicted IP' . As I know whmcs should use 'userid' Column to connect the table 'tblinvoices' and 'tblhosting' , so in this way we can try to connect with them , and get the specified tblinvoices . invoicenum.userid ------ > tblhosting.userid.dedicatedip or domain . I don't know whether this is right . And how to connect with them in the clientareainvoices.tpl page, or have they already connected by default? Relly appreciate for your help . 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 7, 2022 Author Share Posted January 7, 2022 (edited) maybe clientareaproducts.tpl can be a reference . but can we use 2 tablelist in one .tpl file ? {include file="$template/includes/tablelist.tpl" tableName="ServicesList" filterColumn="4" noSortColumns="0"} <script type="text/javascript"> jQuery(document).ready( function () { var table = jQuery('#tableServicesList').removeClass('hidden').DataTable(); {if $orderby == 'product'} table.order([1, '{$sort}'], [4, 'asc']); {elseif $orderby == 'amount' || $orderby == 'billingcycle'} table.order(2, '{$sort}'); {elseif $orderby == 'nextduedate'} table.order(3, '{$sort}'); {elseif $orderby == 'domainstatus'} table.order(4, '{$sort}'); {/if} table.draw(); jQuery('#tableLoading').addClass('hidden'); }); </script> <div class="table-container clearfix"> <table id="tableServicesList" class="table table-list hidden"> <thead> <tr> <th></th> <th>{$LANG.orderproduct}</th> <th>{$LANG.clientareaaddonpricing}</th> <th>{$LANG.clientareahostingnextduedate}</th> <th>{$LANG.clientareastatus}</th> <th class="responsive-edit-button" style="display: none;"></th> </tr> </thead> <tbody> {foreach key=num item=service from=$services} <tr onclick="clickableSafeRedirect(event, 'clientarea.php?action=productdetails&id={$service.id}', false)"> <td class="text-center{if $service.sslStatus} ssl-info{/if}" data-element-id="{$service.id}" data-type="service"{if $service.domain} data-domain="{$service.domain}"{/if}> {if $service.sslStatus} <img src="{$service.sslStatus->getImagePath()}" data-toggle="tooltip" title="{$service.sslStatus->getTooltipContent()}" class="{$service.sslStatus->getClass()}"/> {elseif !$service.isActive} <img src="{$BASE_PATH_IMG}/ssl/ssl-inactive-domain.png" data-toggle="tooltip" title="{lang key='sslState.sslInactiveService'}"> {/if} </td> <td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td> <td class="text-center" data-order="{$service.amountnum}">{$service.amount}<br />{$service.billingcycle}</td> <td class="text-center"><span class="hidden">{$service.normalisedNextDueDate}</span>{$service.nextduedate}</td> <td class="text-center"><span class="label status status-{$service.status|strtolower}">{$service.statustext}</span></td> <td class="responsive-edit-button" style="display: none;"> <a href="clientarea.php?action=productdetails&id={$service.id}" class="btn btn-block btn-info"> {$LANG.manageproduct} </a> </td> </tr> {/foreach} </tbody> </table> <div class="text-center" id="tableLoading"> <p><i class="fas fa-spinner fa-spin"></i> {$LANG.loading}</p> </div> </div> Edited January 7, 2022 by TimRef 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 7, 2022 Author Share Posted January 7, 2022 how can we use two tablename in the .tpl file ? {include file="$template/includes/tablelist.tpl" tableName="InvoicesList" filterColumn="4"} like {include file="$template/includes/tablelist.tpl" tableName="InvoicesList" filterColumn="4"} {include file="$template/includes/tablelist.tpl" tableName="ServicesList" filterColumn="4"} 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 7, 2022 Author Share Posted January 7, 2022 maybe I also need add a Hook file to connect the invoice and services table , or else maybe cannot resolve this case . 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 7, 2022 Author Share Posted January 7, 2022 (edited) 14 hours ago, pRieStaKos said: Just…don’t. Check this and pass the ip to the table hi, @pRieStaKoscan we use this way to connect with the database tables? select * from tblinvoices t1 left join tblinvoiceitems t2 on t1.id=t2.invoiceid left join tblhosting t3 on t2.relid=t3.id WHERE t3.dedicatedIP = value then we use dedicated IP . if get this to Hook , do you have any idea . can we use this type : <?php if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } use WHMCS\Database\Capsule as DB; add_hook('ClientAreaPageInvoices', 1, function($vars) { if (isset($vars['invoices'])) { $csVals = []; foreach ($vars['invoices'] as $invoices) { $fieldVal = ''; $data = DB::table('tblinvoices AS t1') ->leftJoin('tblinvoiceitems AS t2', 't1.id', '=', 't2.invoiceid') ->leftJoin('tblhosting AS t3', 't2.relid', '=', 't3.id') ->select('t3.dedicatedip') ->where('t1.id', $fieldId)->where('t2.type', 'hosting')->where('t3.domain', $invoices['id']) ->first(); if (!is_null($data)) { $fieldVal = $data->value; } $csVals[$invoice['id']] = $fieldVal; } return ['dedicatedip' => $csVals]; } }); //and add {$dedicatedip} to .tpl page / I'm not good at this , sorry to take you any inconveniences. Edited January 7, 2022 by TimRef 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 7, 2022 Share Posted January 7, 2022 Creating a hook to pass the variable to .tpl and adjust the table code to present it, it’s the correct approach. 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 8, 2022 Author Share Posted January 8, 2022 1 hour ago, pRieStaKos said: Creating a hook to pass the variable to .tpl and adjust the table code to present it, it’s the correct approach. Hi, @pRieStaKos , thanks for your help . Do you offer this type of compensable service to get this done ? I have tried long time , I really have no ability to resolve this . Do you have a email to talk ? 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 8, 2022 Share Posted January 8, 2022 25 minutes ago, TimRef said: Hi, @pRieStaKos , thanks for your help . Do you offer this type of compensable service to get this done ? I have tried long time , I really have no ability to resolve this . Do you have a email to talk ? I’m on vacation, but you can contact my team on sales@cubric.gr with your request. 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 8, 2022 Author Share Posted January 8, 2022 9 minutes ago, pRieStaKos said: I’m on vacation, but you can contact my team on sales@cubric.gr with your request. Thanks a lot , I have sent the mail . 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 8, 2022 Share Posted January 8, 2022 17 hours ago, TimRef said: Thanks a lot , I have sent the mail . Hello Tim. Please check if you got a reply on the ticket and if it fills you request. 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 8, 2022 Author Share Posted January 8, 2022 2 hours ago, pRieStaKos said: Hello Tim. Please check if you got a reply on the ticket and if it fills you request. sorry, but i didnt get any email , ang also dont know the ticket link 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 8, 2022 Share Posted January 8, 2022 3 minutes ago, TimRef said: sorry, but i didnt get any email , ang also dont know the ticket link I will post it here: I'm sending you what you can change on your hook and clientareainvoices.tpl: Change your hook like the below. Feel free to change what you like, but follow the flow: <?php if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } use WHMCS\Database\Capsule; add_hook('ClientAreaPageInvoices', 1, function($vars) { if (!empty($vars['invoices'])) { foreach ($vars['invoices'] as $key => $invoices) { // Get service's dedicated ip $data = Capsule::table('tblinvoices AS t1') ->leftJoin('tblinvoiceitems AS t2', 't1.id', '=', 't2.invoiceid') ->leftJoin('tblhosting AS t3', 't2.relid', '=', 't3.id') ->select('t3.dedicatedip') ->where('t1.id', $fieldId)->where('t2.type', 'hosting')->where('t3.domain', $invoices['id']) ->first(); // Assign dedicated ip to invoices template array $vars['invoices'][$key]['dedicatedip'] = !empty($data) ? $data->value : "-"; } // return template invoices array (table) return ["invoices" => $vars['invoices']]; } }); Add the new column on clientareainvoices.tpl <div class="table-container clearfix"> <table id="tableInvoicesList" class="table table-list hidden"> <thead> <tr> <th>{$LANG.invoicestitle}</th> <th>Dedicated IP</th> {* <--- Add this *} <th>{$LANG.invoicesdatecreated}</th> <th>{$LANG.invoicesdatedue}</th> <th>{$LANG.invoicestotal}</th> <th>{$LANG.invoicesstatus}</th> <th class="responsive-edit-button" style="display: none;"></th> </tr> </thead> <tbody> {foreach key=num item=invoice from=$invoices} <tr onclick="clickableSafeRedirect(event, 'viewinvoice.php?id={$invoice.id}', false)"> <td>{$invoice.invoicenum}</td> <td>{$invoice.dedicatedip}</td> {* <--- Add this *} <td><span class="hidden">{$invoice.normalisedDateCreated}</span>{$invoice.datecreated}</td> <td><span class="hidden">{$invoice.normalisedDateDue}</span>{$invoice.datedue}</td> <td data-order="{$invoice.totalnum}">{$invoice.total}</td> <td><span class="label status status-{$invoice.statusClass}">{$invoice.status}</span></td> <td class="responsive-edit-button" style="display: none;"> <a href="viewinvoice.php?id={$invoice.id}" class="btn btn-block btn-info"> {$LANG.invoicesview} </a> </td> </tr> {/foreach} </tbody> </table> <div class="text-center" id="tableLoading"> <p><i class="fas fa-spinner fa-spin"></i> {$LANG.loading}</p> </div> </div> If the service doesn't have a Dedicated IP , the table will show a "- ". Feel free to ask anything else, for this. As for the price, you can buy me a coffee (or two) here . 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 8, 2022 Author Share Posted January 8, 2022 7 minutes ago, pRieStaKos said: I will post it here: I'm sending you what you can change on your hook and clientareainvoices.tpl: Change your hook like the below. Feel free to change what you like, but follow the flow: <?php if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } use WHMCS\Database\Capsule; add_hook('ClientAreaPageInvoices', 1, function($vars) { if (!empty($vars['invoices'])) { foreach ($vars['invoices'] as $key => $invoices) { // Get service's dedicated ip $data = Capsule::table('tblinvoices AS t1') ->leftJoin('tblinvoiceitems AS t2', 't1.id', '=', 't2.invoiceid') ->leftJoin('tblhosting AS t3', 't2.relid', '=', 't3.id') ->select('t3.dedicatedip') ->where('t1.id', $fieldId)->where('t2.type', 'hosting')->where('t3.domain', $invoices['id']) ->first(); // Assign dedicated ip to invoices template array $vars['invoices'][$key]['dedicatedip'] = !empty($data) ? $data->value : "-"; } // return template invoices array (table) return ["invoices" => $vars['invoices']]; } }); Add the new column on clientareainvoices.tpl <div class="table-container clearfix"> <table id="tableInvoicesList" class="table table-list hidden"> <thead> <tr> <th>{$LANG.invoicestitle}</th> <th>Dedicated IP</th> {* <--- Add this *} <th>{$LANG.invoicesdatecreated}</th> <th>{$LANG.invoicesdatedue}</th> <th>{$LANG.invoicestotal}</th> <th>{$LANG.invoicesstatus}</th> <th class="responsive-edit-button" style="display: none;"></th> </tr> </thead> <tbody> {foreach key=num item=invoice from=$invoices} <tr onclick="clickableSafeRedirect(event, 'viewinvoice.php?id={$invoice.id}', false)"> <td>{$invoice.invoicenum}</td> <td>{$invoice.dedicatedip}</td> {* <--- Add this *} <td><span class="hidden">{$invoice.normalisedDateCreated}</span>{$invoice.datecreated}</td> <td><span class="hidden">{$invoice.normalisedDateDue}</span>{$invoice.datedue}</td> <td data-order="{$invoice.totalnum}">{$invoice.total}</td> <td><span class="label status status-{$invoice.statusClass}">{$invoice.status}</span></td> <td class="responsive-edit-button" style="display: none;"> <a href="viewinvoice.php?id={$invoice.id}" class="btn btn-block btn-info"> {$LANG.invoicesview} </a> </td> </tr> {/foreach} </tbody> </table> <div class="text-center" id="tableLoading"> <p><i class="fas fa-spinner fa-spin"></i> {$LANG.loading}</p> </div> </div> If the service doesn't have a Dedicated IP , the table will show a "- ". Feel free to ask anything else, for this. As for the price, you can buy me a coffee (or two) here . thanks , I will try , and update you soon , also , i tried reset password via cubric, didnt get anything, thanks anyway 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 8, 2022 Author Share Posted January 8, 2022 21 minutes ago, TimRef said: thanks , I will try , and update you soon , also , i tried reset password via cubric, didnt get anything, thanks anyway 32 minutes ago, pRieStaKos said: I will post it here: I'm sending you what you can change on your hook and clientareainvoices.tpl: Change your hook like the below. Feel free to change what you like, but follow the flow: <?php if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } use WHMCS\Database\Capsule; add_hook('ClientAreaPageInvoices', 1, function($vars) { if (!empty($vars['invoices'])) { foreach ($vars['invoices'] as $key => $invoices) { // Get service's dedicated ip $data = Capsule::table('tblinvoices AS t1') ->leftJoin('tblinvoiceitems AS t2', 't1.id', '=', 't2.invoiceid') ->leftJoin('tblhosting AS t3', 't2.relid', '=', 't3.id') ->select('t3.dedicatedip') ->where('t1.id', $fieldId)->where('t2.type', 'hosting')->where('t3.domain', $invoices['id']) ->first(); // Assign dedicated ip to invoices template array $vars['invoices'][$key]['dedicatedip'] = !empty($data) ? $data->value : "-"; } // return template invoices array (table) return ["invoices" => $vars['invoices']]; } }); Add the new column on clientareainvoices.tpl <div class="table-container clearfix"> <table id="tableInvoicesList" class="table table-list hidden"> <thead> <tr> <th>{$LANG.invoicestitle}</th> <th>Dedicated IP</th> {* <--- Add this *} <th>{$LANG.invoicesdatecreated}</th> <th>{$LANG.invoicesdatedue}</th> <th>{$LANG.invoicestotal}</th> <th>{$LANG.invoicesstatus}</th> <th class="responsive-edit-button" style="display: none;"></th> </tr> </thead> <tbody> {foreach key=num item=invoice from=$invoices} <tr onclick="clickableSafeRedirect(event, 'viewinvoice.php?id={$invoice.id}', false)"> <td>{$invoice.invoicenum}</td> <td>{$invoice.dedicatedip}</td> {* <--- Add this *} <td><span class="hidden">{$invoice.normalisedDateCreated}</span>{$invoice.datecreated}</td> <td><span class="hidden">{$invoice.normalisedDateDue}</span>{$invoice.datedue}</td> <td data-order="{$invoice.totalnum}">{$invoice.total}</td> <td><span class="label status status-{$invoice.statusClass}">{$invoice.status}</span></td> <td class="responsive-edit-button" style="display: none;"> <a href="viewinvoice.php?id={$invoice.id}" class="btn btn-block btn-info"> {$LANG.invoicesview} </a> </td> </tr> {/foreach} </tbody> </table> <div class="text-center" id="tableLoading"> <p><i class="fas fa-spinner fa-spin"></i> {$LANG.loading}</p> </div> </div> If the service doesn't have a Dedicated IP , the table will show a "- ". Feel free to ask anything else, for this. As for the price, you can buy me a coffee (or two) here . tried this ,all invoice dedicated ip shown '-' , see the photo , sometimes one invoice have more than 1 server or hosting . maybe we should add a judge ? but , only one in the invoice , also not shown .only can see '- ' is the ‘ClientAreaPageInvoices’ we used right ? seems didnt get the dedicated ip to pass . 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 8, 2022 Share Posted January 8, 2022 The hook index is correct as it will return the IP address so table will render. You need to decide what you want to present this and change the query properly: - One invoice can have many products that got one dedicated ip. How will you present this. Comma separated ? Tooltip ? So you will have to check the invoices items for the service’s dedicated ip. 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 8, 2022 Author Share Posted January 8, 2022 8 minutes ago, pRieStaKos said: The hook index is correct as it will return the IP address so table will render. You need to decide what you want to present this and change the query properly: - One invoice can have many products that got one dedicated ip. How will you present this. Comma separated ? Tooltip ? So you will have to check the invoices items for the service’s dedicated ip. if one invoice have more than 1 products , we can only use the top one of it . but currently , only 1 product invoice , also not showing the ip. I am thinking maybe the pass or connection of field not correct ? Thanks for your time in advance 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 8, 2022 Share Posted January 8, 2022 4 minutes ago, TimRef said: if one invoice have more than 1 products , we can only use the top one of it . but currently , only 1 product invoice , also not showing the ip. I am thinking maybe the pass or connection of field not correct ? Thanks for your time in advance Yea. Query gets the first record. A better query or a loop should work. 0 Quote Link to comment Share on other sites More sharing options...
TimRef Posted January 8, 2022 Author Share Posted January 8, 2022 20 minutes ago, pRieStaKos said: The hook index is correct as it will return the IP address so table will render. You need to decide what you want to present this and change the query properly: - One invoice can have many products that got one dedicated ip. How will you present this. Comma separated ? Tooltip ? So you will have to check the invoices items for the service’s dedicated ip. BTW, when I try to buy coffee , show me Failed to verify captcha. do you have any other way to do this ? like paypal 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.