Results 1 to 4 of 4

Thread: Add itemization to custom HTML invoice help?

  1. #1
    Join Date
    Feb 2008
    Location
    Des Moines, Iowa
    Posts
    5

    Default Add itemization to custom HTML invoice help?

    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):

    Code:
    {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

  2. #2
    Join Date
    Sep 2011
    Posts
    44

    Default

    sorry, answer duplicated
    Last edited by sdemidko; 07-06-12 at 09:26 AM. Reason: duplicate

  3. #3
    Join Date
    Sep 2011
    Posts
    44

    Default

    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}

  4. #4
    Join Date
    Feb 2008
    Location
    Des Moines, Iowa
    Posts
    5

    Default

    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:


    Code:
    {foreach key=num from=$invoice_items item=invoiceitem}                  
    <tr>
    <td>{$invoiceitem.description}</td>
    <td>{$invoiceitem.amount}</td>
    </tr>
    {/foreach}

Similar Threads

  1. Custom HTML on PDF Invoice?
    By willow in forum Customisation & Integration Questions
    Replies: 2
    Last Post: 07-06-12, 09:39 PM
  2. Add custom html to whmcs?
    By Blazin22 in forum Customisation & Integration Questions
    Replies: 1
    Last Post: 08-26-11, 01:06 PM
  3. Add Product's custom field to automatic invoice
    By argon in forum Customisation & Integration Questions
    Replies: 0
    Last Post: 06-12-09, 05:50 PM
  4. Add Custom field to the invoice table
    By Fonix in forum Feature Requests
    Replies: 1
    Last Post: 09-05-06, 10:03 PM