Hi stack i have one issue that dont know how to resolve. I want to show Dedicated IP from customer order to show like this:
I make a short check, and found that need to be done into viewinvoice.tpl and invoicepdf.tpl files. i found that dedicated ip is stores into tblhosting table in database.
I found this code:
{php}
$clienthosting = $this->get_template_vars(service);
$dbid = $clienthosting['id'];
$query = mysql_query("SELECT dedicatedip FROM tblhosting WHERE id = $dbid");
$result = mysql_fetch_array($query);
$dedicatedip = $result["dedicatedip"];
$this->assign("dedicatedip", $dedicatedip);
{/php}
and finally to print:
<td>{if $dedicatedip gt 0} - {$dedicatedip}{/if}{/if}</td>
and this is code from invoice.tpl where is printing data from customer purchase:
<tbody>
{foreach from=$invoiceitems item=item}
<tr>
<td>{$item.description}{if $item.taxed eq "true"} *{/if}</td>
<td class="text-center">{$item.amount}</td>
</tr>
{/foreach}
<tr>
<td class="total-row text-right"><strong>{$LANG.invoicessubtotal}</strong></td>
<td class="total-row text-center">{$subtotal}</td>
</tr>
{if $taxrate}
<tr>
<td class="total-row text-right"><strong>{$taxrate}% {$taxname}</strong></td>
<td class="total-row text-center">{$tax}</td>
</tr>
{/if}
{if $taxrate2}
<tr>
<td class="total-row text-right"><strong>{$taxrate2}% {$taxname2}</strong></td>
<td class="total-row text-center">{$tax2}</td>
</tr>
{/if}
<tr>
<td class="total-row text-right"><strong>{$LANG.invoicescredit}</strong></td>
<td class="total-row text-center">{$credit}</td>
</tr>
<tr>
<td class="total-row text-right"><strong>{$LANG.invoicestotal}</strong></td>
<td class="total-row text-center">{$total}</td>
</tr>
</tbody>
But this seems that generate white screen only when try to execute. Any help here?
Create php file in
whmcs_dir/includes/hooks/
(say: dedicated_ip.php) and add the following code:This code will run only in the invoice view page, and adds an array of dedicated IPs for each invoice items. Domains for example will have empty ip.
Then in viewinvoice.tpl update the invoice items loop as following: