How to customize layout for %invoice_text%?

Discussion in 'Templates customization' started by orish, May 20, 2014.

  1. orish

    orish aMember Pro Customer

    Joined:
    Mar 15, 2011
    Messages:
    43
    Hi, I noticed there was another thread related to this question, but it seemed to involve recoding a core PHP file.

    I need to send a confirmation email to my customers for their payments, but at the moment it's a real mess and looks very unprofessional.

    This is what my customers get:

    Invoice #DC6EB / 20/05/2014 ------------------------------------------------------------------- 1. Read Thai Video Workshop Package MP4 1x10000.00 7500.00 THB ------------------------------------------------------------------- Subtotal 10000.00 THB Discount 2500.00 THB Total 7500.00 THB -------------------------------------------------------------------

    I'd like to define a layout and format the purchase items.
    • There's only one item that gets purchased at a time in my case, although there may be some free add-ons.
    • Because I'm using the Thai Baht as the currency, it's messy to add the .00 at the end of each amount and I need to add in the thousands comma.
    • Also the currency symbol should be on the left hand side, not the right of the amount
    • The currency symbol should only appear on the total amount.
    • If there is no discount then there is no need for a total amount - just the price of the item (in which case it will have the currency symbol).
    • I also don't need the date (the date of payment is the date of the email) or invoice number because it's completely irrelevant.
    • Finally, the dashed lines makes the layout look amateur, especially when the email confirmation is in HTML. Either use an HTML table or leave out the lines completely.
    So the above invoice (actually it's not an invoice, it's a receipt) should look like this:

    Purchase Details
    Read Thai Video Workshop Package MP4 10,000
    Discount Coupon (student) 2,500
    Total paid THB 7,500

    How do I do this, preferably without writing a mini program to do it?
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,669
    First of all in case you use %invoice_text% placeholder in context of HTML you need to wrap it with <pre> tags eg.
    HTML:
    <pre>
    %invoice_text%
    </pre>
    It is not possible to customize output of this placeholder without changes in core files. Definition of this placeholder can be found in file /application/default/models/Invoice.php method render

    It is possible to define custom placeholder eg. %receipt% and format it as necessary based on invoice object.
    You can do it in site.php file (http://www.amember.com/docs/Site.php_file) so these changes will not be overwritten with upgrade in future.

    Please have a look how to define custom placeholder
    http://www.amember.com/docs/How_to_add_custom_placeholders_to_email_templates

    You need to know PHP in order to implement it.
  3. russell_stutely

    russell_stutely aMember Pro Customer

    Joined:
    Jul 25, 2007
    Messages:
    29
    I want to do exactly the same.. but do not understand one word of the answer or documentation.

    Would it not be real simple for amember just to tidy up the standard invoice / receipt layout in the next update?

Share This Page