Onion - the missing ingredient for Sage Line 50 / Sage Instant accounts packs in Excel

Onion - the missing ingredient for Sage Line 50 / Sage Instant accounts packs in Excel
Full audit trails to underlying transactions from P&Ls, Balance Sheets, graphs, PivotTables, and departmental TBs in a stand-alone Excel file. Aged Debtors and Aged Creditor files too. Free 30 day trials. Download today at www.onionrs.co.uk

Monday 15 July 2013

Changing the font of OpenCart mail communications

Opencart has a "newsletter" email facility to communicate with customers. I recently used it for the first time and discovered that, whilst in drafting mode the font of the email text had looked something like Arial (acceptable to me), the text of the email was Times New Roman (I just can't like this font).

There then ensued a search for how to control the default font type of the outgoing email html.  I don't want to have to hand code the source HTML for every communication. 

I eventually found how to do it and share it here in the hopes that it will save someone else the long and frustrating search I had to locate something I would have hoped would be easily found online. Not so!


  1. Locate the file admin/controller/sale/contact.php.
  2. Go to line 230 in that file. The line reads: $message .= '  <body>' . html_entity_decode($this->request->post['message'], ENT_QUOTES, 'UTF-8') . '</body>' . "\n";
  3. Change the text: '<body>' to '<body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">' .
  4. Save the file

The full line should read: $message .= '  <body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">' . html_entity_decode($this->request->post['message'], ENT_QUOTES, 'UTF-8') . '</body>' . "\n";

Your communications should now be in the font of your choice by default.

9 comments:

  1. Hi there

    Great post - Can't believe more Opencart users are not complaining about this!!!

    Having trouble understanding what exactly needs changing though.

    You say line 230 (when I try to editthe file I don't get line numbers!!!) - Could you give me the exact line (as is) and how it should be to get a correct font (NOT Times Roman 0- which I too hate!!)

    Thanks in advance

    Anthony

    ReplyDelete
    Replies
    1. I've put the full line in the text and have hopefully fixed a problem with the original post where the text and replacement text didn't show (at least not on my browser). The line is near the bottom of the file.

      I hope this helps

      Delete
    2. Hi Ian

      Very kind of you to reply so quickly and thank you for the clarification. I made the alteration to the file as suggested but it doesn't seem to have changed the emails sent out by opencart (I'm using 1.5.5.1). Anything else I need to do?

      Thanks in advance, Anthony

      Delete
  2. Anthony,

    No. I'm using 1.5.5.1 too and it is working for me. Can you copy the line from the file on your server and post it here just in case it is something simple?

    ReplyDelete
  3. Hi Ian

    Thanks for your reply again - below is direct copy and paste from the file (admin/controller/sale/contact.php):

    I have substituted the tag body for bidy as the site would let me put html tags in!!!!!

    $message .= ' ' . html_entity_decode($this->request->post['message'], ENT_QUOTES, 'UTF-8') . '' . "\n";

    I copied your line above and my line in the file and compared in note pad - they are exactly the same.

    Am I correct in assuming this will fix all emails sent from Opencart - ie: Order confirmation, order status up-dates, ciontact email etc.... ?

    Thanks in advance, Anthony

    ReplyDelete
  4. Hi Ian - me again - Your site is definitely not letting me put HTML tags in !!! but I can assure you that exactly what you have written above in your post is what I copied and have in my file

    Anthony

    ReplyDelete
  5. Anthony,

    I'd only established that the file admin/controller/sale/contact.php allowed control of the font of the newsletter in OpenCart. I think it likely that different files will control the font of other outputs.

    Regards,

    Ian

    ReplyDelete
  6. Hi Ian

    Thanks for the clarification - I'll have a dig around for the other files !!!!

    All the best, Anthony

    ReplyDelete
  7. Anthony,

    This link might be of interest. http://www.w360wiki.com/opencart/font-family-incorrect.html

    Regards,

    Ian

    ReplyDelete