我试图在WHMCS中将产品ID添加到我的发票中,但似乎没有任何东西起作用。下面是关于这一行代码的内容:
<span class="title">{$LANG.invoicenumber}{*{else}{$LANG.proformainvoicenumber}{/if}*}{$invoicenum} - Service ID #{$invoiceitems.relid}</span><br />这里的这个部分具体是我添加的,但没有工作的部分:
- Service ID #{$invoiceitems.relid}当我运行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,这样这条线就会显示如下:
发票#7691 -服务ID #801
任何帮助都将不胜感激。提前感谢!
发布于 2014-12-22 15:24:03
在发票#之后添加以下代码:
{if $invoiceitems|@count > 0}
Service ID: #{$invoiceitems[0].relid}
{/if}您可能需要在输出服务ID之前检查$invoiceitems.type是否是域或主机。
发布于 2013-02-18 18:02:40
{$invoiceitems}是模板页面上的整个项数组。因此,当您试图通过{$invoiceitems.relid}访问时,不会给出任何结果,因为您需要通过索引在{$invoiceitems}数组中获取项,然后就可以到达名为relid的属性。
我认为数组中的迭代将解决您的问题。
{foreach key=num item=singleitem from=$invoiceitems}
{$singleitem.relid} // here you can reach the property.
{/foreach }https://stackoverflow.com/questions/14863299
复制相似问题