I searched into Stackoverflow for my work that I want to do, and found this thread helpful, but seems that is not working properly.
What do I?
Created a hook into /includes/hooks/ with this code:
foreach ($vars['invoiceitems'] as $k => $item) { $ip = ''; if ($item['type'] == 'Hosting') { $hosting = DB::table('tblhosting')->select('dedicatedip')- >where('id', $item['relid'])->first(); if (!is_null($hosting)) { $ip = $hosting->dedicatedip; } } $dedicatedIps[$k] = $ip; } return ['dedicatedIps' => $dedicatedIps]; });
Replaced this loop from viewinvoice.tpl file with this one:
{foreach from=$invoiceitems item=item key=key} <tr> <td> {$item.description}{if $item.taxed eq "true"} *{/if} {if $key|in_array:$dedicatedIps} <br>IP: {$dedicatedIps[$key]} {/if} </td> <td class="text-center">{$item.amount}</td> </tr> {/foreach}
and seems to show Dedicated IP but only for order #4250 in my case. PHPMyAdmin table:
when check into tblhosting table for that order I see Dedicated IP, and it's showing into invoice:
but there is Dedicated IP for many other orders too, but when check that Dedicated IP is not shown for that orders. Where is the issue in this code?