2013-02-13 77 views
0

我试图在WHMCS中将产品ID添加到我的发票中,但似乎没有任何工作。这就是我现在所拥有的该行的代码:将产品ID添加到WHMCS发票

<span class="title">{$LANG.invoicenumber}{*{else}{$LANG.proformainvoicenumber}{/if}*}{$invoicenum} - Service ID #{$invoiceitems.relid}</span><br /> 

这在这里具体而言,是我在添加的部分,而不是工作:

- Service ID #{$invoiceitems.relid} 

当我运行调试看不同的变量比使用它表明{$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

任何帮助将不胜感激。提前致谢!

回答

0

{$invoiceitems}是模板页面上的整个项目数组。 所以当你试图达到{$invoiceitems.relid},不会给任何结果,因为你需要通过索引获得{$invoiceitems}数组中的项目,然后你可以到达那个名为relid的属性。

我认为数组中的迭代将解决您的问题。

{foreach key=num item=singleitem from=$invoiceitems} 
    {$singleitem.relid} // here you can reach the property. 
{/foreach } 
1

添加以下代码后,发票号码:

{if $invoiceitems|@count > 0} 
Service ID: #{$invoiceitems[0].relid} 
{/if} 

可能是你需要检查$ invoiceitems [0] .TYPE,作为一个域或托管是前输出的服务ID。