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!
- Locate the file admin/controller/sale/contact.php.
- 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";
- Change the text: '<body>' to '<body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">' .
- 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.
Hi there
ReplyDeleteGreat 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
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.
DeleteI hope this helps
Hi Ian
DeleteVery 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
Anthony,
ReplyDeleteNo. 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?
Hi Ian
ReplyDeleteThanks 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
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
ReplyDeleteAnthony
Anthony,
ReplyDeleteI'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
Hi Ian
ReplyDeleteThanks for the clarification - I'll have a dig around for the other files !!!!
All the best, Anthony
Anthony,
ReplyDeleteThis link might be of interest. http://www.w360wiki.com/opencart/font-family-incorrect.html
Regards,
Ian