Php 将产品ID添加到WHMCS发票
我试图在WHMCS中将产品ID添加到我的发票中,但似乎没有任何效果。下面是我现在对这行代码的了解:Php 将产品ID添加到WHMCS发票,php,mysql,arrays,whmcs,Php,Mysql,Arrays,Whmcs,我试图在WHMCS中将产品ID添加到我的发票中,但似乎没有任何效果。下面是我现在对这行代码的了解: <span class="title">{$LANG.invoicenumber}{*{else}{$LANG.proformainvoicenumber}{/if}*}{$invoicenum} - Service ID #{$invoiceitems.relid}</span><br /> 当我运行debug查看不同于所使用的变量时,它显示{$invoic
<span class="title">{$LANG.invoicenumber}{*{else}{$LANG.proformainvoicenumber}{/if}*}{$invoicenum} - Service ID #{$invoiceitems.relid}</span><br />
当我运行debug查看不同于所使用的变量时,它显示{$invoiceitems}
可用于显示如下项目:
Array (2)
0 => Array (6)
id => 1830
type => Hosting
relid => 801
description => My Hosting Services - dsdjsjd....
amount => $295.00 USD
taxed =>
1 => Array (6)
id => 1831
type => PromoHosting
relid => 801
description => Promotional Code: FREETRIAL - $0.01 U...
amount => $-294.99 USD
taxed =>
我想得到的是801号,因此该行显示如下:
Array (2)
0 => Array (6)
id => 1830
type => Hosting
relid => 801
description => My Hosting Services - dsdjsjd....
amount => $295.00 USD
taxed =>
1 => Array (6)
id => 1831
type => PromoHosting
relid => 801
description => Promotional Code: FREETRIAL - $0.01 U...
amount => $-294.99 USD
taxed =>
发票#7691-服务ID#801
任何帮助都将不胜感激。提前谢谢
{$invoiceitems}
是模板页面上的整个项目数组。
因此,当您尝试通过{$invoiceitems.relid}
访问时,不会给出任何结果,因为您需要通过索引获取{$invoiceitems}
数组中的项,然后才能访问名为relid的属性
我认为数组中的迭代将解决您的问题
{foreach key=num item=singleitem from=$invoiceitems}
{$singleitem.relid} // here you can reach the property.
{/foreach }
在发票#后添加以下代码: 您可能需要检查$invoiceitems[0]。在输出服务ID之前,请键入是否为域或主机
{if $invoiceitems|@count > 0}
Service ID: #{$invoiceitems[0].relid}
{/if}