Jump to content

Add itemization to custom HTML invoice help?


lancert

Recommended Posts

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

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated