Invoice Email Template

lgilliver
lgilliver
Offline
0
I see in the forum that back in 2014 it was questioned whether the content of the email generated could be different to the actual Invoice being sent as an attachment in PDF.

Has this progressed any further? I would really like to be able to have the email content read something like "Hello {client name}, Please find attached your invoice for recent work etc" and the attachment to be the PDF version of the invoice.

This seems to be a key feature missing from an otherwise great package.

If it isn't implemented, could you point me in the direction of the MVC parts that would require editing to make it happen.
Responses (3)
  • Accepted Answer

    Joan Vilà
    Joan Vilà
    Offline
    Monday, March 02 2015, 10:02 AM - #Permalink
    0
    Hello,

    We are working to include this feature in the new version of Invoice Manager, 1.4, which we are working on.
    We can't tell you an ETA yet, we will notify you when it's ready.
    In the meantime, if you want to try to add this text for yourself (which shouldn't be too difficult), the function you are looking for is "sendMail()", which you will find in the file:
    /components/com_invoices/models/invoice.php

    let me know if that helps.
    The reply is currently minimized Show
  • Accepted Answer

    lgilliver
    lgilliver
    Offline
    Monday, March 02 2015, 10:24 PM - #Permalink
    0
    Great, that was a brilliant help to get me started, I've got it completed now. For those that are interested here is what I did:

    Added two new fields to the Component Options in the backend where the "Email body" can be added, one for Invoices, another for Quotes
    /administrator/components/com_invoices/config.xml

    <field name="email_body_quote" type="textarea" default="Message body" label="Quotes Email Body" description="Email body for Quotes that are sent out" rows="20" cols="50" filter="raw" />

    <field name="email_body_invoice" type="textarea" default="Message body" label="Invoice Email Body" description="Email body for Invoices that are sent out" rows="20" cols="50" filter="raw"/>


    Then updated the models found in:
    /components/com_invoices/models/

    invoice.php
    First of all around line 740:

    if($view->template->content_pdf) $view->template->content = $view->template->content ; // Removes the PDF as the main body
    //if($view->template->content_pdf) $view->template->content = $view->template->content_pdf ; // Keep this in to revert if necessary


    Secondly around line 750:

    $message = $params->get('email_body_invoice'); // Grabs the parameter set in the component global options
    $message = str_replace("{client}", $data->to_name, $message) ; // Does a quick string replace to grab the customer name
    //$message = $view->loadTemplate( $plantilla ); // Keep this in to revert if necessary


    quote.php
    Nearly the same as above, except change 'email_body_invoice' for 'email_body_quote' around line 750.

    Hope that helps someone.
    The reply is currently minimized Show
  • Accepted Answer

    Joan Vilà
    Joan Vilà
    Offline
    Tuesday, March 03 2015, 03:40 PM - #Permalink
    0
    Hello Igilliver,

    Thank you for sharing your solution.
    We are going to take it into account for the new version that we are preparing.

    Greetings,
    Joan
    The reply is currently minimized Show
Your Reply