lancert Posted July 2, 2012 Share Posted July 2, 2012 Hi Everyone, I've created a custom HTML invoice but I'm having issues with it displaying the itemization of the invoice. Here's what I have so far (it's inside a table already): {foreach key=num item=invoiceitem from=$invoice_items} <tr> <td>{$invoiceitem.description}</td> <td>{$invoiceitem.amount}</td> </tr> {/foreach} With the code above, only the last item is displayed and not each item. Can anyone help me make this work? Is it possible? Secondly, once I get this working, how do I set it to be the default email that gets sent when the invoice is generated? Thank you for your help! Lance 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted July 6, 2012 Share Posted July 6, 2012 (edited) sorry, answer duplicated Edited July 6, 2012 by sdemidko duplicate 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted July 6, 2012 Share Posted July 6, 2012 there is no such variable: $invoice_items the correct name is: $invoiceitems so correct cycle would be: {foreach key=num item=invoiceitem from=$invoiceitems} <tr> <td>{$invoiceitem.description}</td> <td>{$invoiceitem.amount}</td> </tr> {/foreach} 0 Quote Link to comment Share on other sites More sharing options...
lancert Posted July 6, 2012 Author Share Posted July 6, 2012 sdemidko, thanks for your response! I REALLY appreciate it, however, the info you gave me isn't what is listed in the available merge fields listed below the editor in WHMCS. The available array they give is: {$invoice_items} I also discovered the problem I was having. When I toggle between the WYSIWYG editor and HTML code view, the editor moves the "foreach" tags outside of the table tags and was messing it up. I saved without switching the WYSIWYG view and it worked fine. Thank you again for your help! For anyone else curious, I used the following code in my email template and it seems to work: {foreach key=num from=$invoice_items item=invoiceitem} <tr> <td>{$invoiceitem.description}</td> <td>{$invoiceitem.amount}</td> </tr> {/foreach} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.