I'm using WHMCS 8.x and Smarty PHP is already enabled.
I hope to use some code or hook function to let the dedicated ip or hostname to display on the page clientareainvoices.tpl (/clientarea.php?action=invoices) list . I hope anyone can help me with this . Thanks alot .
I have search a lot of plan , but all not working . I don't know whether this can be done with hook .
Hope someone of genius can help me about this .
the function like this in the picture .
enter image description here thanks thanks thanks.
I tried to use a hook file to do this . and tried to connect the database tables use left join . like : the file is like :
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
And I add this into the hook file .
<?php
if (!defined("WHMCS")) {
die("This file cannot be accessed directly");
}
use WHMCS\Database\Capsule as DB;
add_hook('ClientAreaPageInvoices', 1, function($vars) {
$invoices = DB::table('tblinvoices')->where('invoicenum', $vars['invoicenum'])->get();
$fieldId = 'invoicenum';
$csVals = [];
foreach ($invoices as $invoice) {
$fieldVal = '';
$data = DB::table('tblinvoices AS t1')
->leftJoin('tblinvoiceitems AS t2', 't1.invoicenum', '=', 't2.invoiceid')
->leftJoin('tblhosting AS t3', 't2.relid', '=', 't3.id')
->select('t3.domain')
->where('t1.invoicenum', $fieldId)->where('t3.domain', $invoice['invoicenum'])
->first();
if (!is_null($data)) {
$fieldVal = $data->value;
}
$csVals[$invoice['invoicenum']] = $fieldVal;
}
return ['domain' => $csVals];
});
But all not working for this . it shows a result "Array" , hope anybody can hlep me . thanks in advance .