harron ejaz harron ejaz - 2 months ago 10
PHP Question

How to add html in language file of opencart 2.0.1.1?

Actually i need to do this
When a customer gets rewards points he gets notified by email. The default email contains only these lines :

You have received 200 Reward Points!

Your total number of reward points is now 200.


I know this text is in language file at

/admin/language/english/mail/customer.php
$_['text_reward_received'] = 'You have received %s Reward Points!';
$_['text_reward_total'] = 'Your total number of reward points is now %s.';


I need to apply some css styling on this email notification relative to my opencart store. I tried adding html and css in this customer.php language file but it won't work. I don't have any idea how can I apply styling i want. I need to know that Can i add html in a model file or not ?? If yes then how ?

Answer

I was unable to add html in language file because in model the method used to send mail was using

$mail ->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));

I have changed this to :

$mail ->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));

It then allowed me to add html in language file.

Comments