07-26-2023, 03:12 PM
I'm using WHMCS 7.x and Smarty PHP is already enabled.
I want to show in the client area products (clientareaproducts.tpl) below the name of the product, a custom field which already exists and it's filled with an IP adress ( the smarty PHP code for that custom field is **{$service_custom_fields.4}** ) instead of **$service.domain**.
Below is the **clientareaproducts.tpl** file:
{include file="$template/includes/tablelist.tpl" tableName="ServicesList" filterColumn="3"}
<script type="text/javascript">
{if $orderby == 'product'}
table.order([0, '{$sort}'], [3, 'asc']);
{elseif $orderby == 'amount' || $orderby == 'billingcycle'}
table.order(1, '{$sort}');
{elseif $orderby == 'nextduedate'}
table.order(2, '{$sort}');
{elseif $orderby == 'domainstatus'}
table.order(3, '{$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>{$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&amp;id={$service.id}', false)">
<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&amp;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="fa fa-spinner fa-spin"></i> {$LANG.loading}</p>
</div>
</div>
I've tried replacing the following line:
<td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td>
with
<td><strong>{$service.product}</strong>{if $service_custom_fields.4}<br /><a href="http://{$service_custom_fields.4}" target="_blank">{$service_custom_fields.4}</a>{/if}</td>
but unfourtunately, it doesn't work.
The smarty php code works on the email templates, but not here.
I've also tried with the following line by adding a domain to the product, but it doesn't show the custom field either.
<td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service_custom_fields.4}" target="_blank">{$service_custom_fields.4}</a>{/if}</td>
I did that because i thought *domainstatus*
{elseif $orderby == 'domainstatus'}
would be setted to false if the domain was empty and by adding a domain, it would then be setted to true, and it would show the custom field, but it doesn't work.
I'd really appreciate if someone could please help me.
Regards.
I want to show in the client area products (clientareaproducts.tpl) below the name of the product, a custom field which already exists and it's filled with an IP adress ( the smarty PHP code for that custom field is **{$service_custom_fields.4}** ) instead of **$service.domain**.
Below is the **clientareaproducts.tpl** file:
{include file="$template/includes/tablelist.tpl" tableName="ServicesList" filterColumn="3"}
<script type="text/javascript">
{if $orderby == 'product'}
table.order([0, '{$sort}'], [3, 'asc']);
{elseif $orderby == 'amount' || $orderby == 'billingcycle'}
table.order(1, '{$sort}');
{elseif $orderby == 'nextduedate'}
table.order(2, '{$sort}');
{elseif $orderby == 'domainstatus'}
table.order(3, '{$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>{$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&amp;id={$service.id}', false)">
<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&amp;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="fa fa-spinner fa-spin"></i> {$LANG.loading}</p>
</div>
</div>
I've tried replacing the following line:
<td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td>
with
<td><strong>{$service.product}</strong>{if $service_custom_fields.4}<br /><a href="http://{$service_custom_fields.4}" target="_blank">{$service_custom_fields.4}</a>{/if}</td>
but unfourtunately, it doesn't work.
The smarty php code works on the email templates, but not here.
I've also tried with the following line by adding a domain to the product, but it doesn't show the custom field either.
<td><strong>{$service.product}</strong>{if $service.domain}<br /><a href="http://{$service_custom_fields.4}" target="_blank">{$service_custom_fields.4}</a>{/if}</td>
I did that because i thought *domainstatus*
{elseif $orderby == 'domainstatus'}
would be setted to false if the domain was empty and by adding a domain, it would then be setted to true, and it would show the custom field, but it doesn't work.
I'd really appreciate if someone could please help me.
Regards.