@ I Blog
Travel, Food & Me.

Opencart 1.5.6.x Add Customer Name Plus Change Greeting Text

Opencart 1.5.6.x Add Customer Name Plus Change Greeting Text. This is how to add customer 1st name into the order confirmation email plus changing the default greeting text to something that suits your web store. Opencart order confirmation email by default is very simple, therefore, you might want to change some minor information. Here is where you will need to make the changes:-

  • Open and Edit the catalog/language//mail/order.php

$_[‘text_new_greeting’] = ‘Thank you for your interest in %s products. Your order has been received and will be processed once payment has been confirmed.’;

add this one

$_[‘text_title’] = ‘Hello %s,’;

  • Open and Edit catalog/model/checkout/order.php – search for method confirm() and then find the line

$template->data[‘text_greeting’] = sprintf($language->get(‘text_new_greeting’), html_entity_decode($order_info[‘store_name’], ENT_QUOTES, ‘UTF-8’));

and before it add this one:

$template->data[‘text_title’] = sprintf($language->get(‘text_title’), html_entity_decode($order_info[‘payment_firstname’], ENT_QUOTES, ‘UTF-8’));

  • Also to mention that this should be done twice – once for HTML template part and once for TEXT template part (scroll down a little bit for TEXT tpl part).

$text = sprintf($language->get(‘text_title’), html_entity_decode($order_info[‘payment_firstname’], ENT_QUOTES, ‘UTF-8’)) . “\n\n”;
$text = sprintf($language->get(‘text_new_greeting’), html_entity_decode($order_info[‘store_name’], ENT_QUOTES, ‘UTF-8’)) . “\n\n”;

  • Finally, Open and Edit¬†catalog/view/theme//template/mail/order.tpl and find the line:
    <p style=”margin-top: 0px; margin-bottom: 20px;”><?php echo $text_greeting; ?></p> and add before the text greeting text
    <p style=”margin-top: 0px; margin-bottom: 20px;”><?php echo $text_title;¬†?></p>

And you should get something like in this image as shown below

There you go, as marked with boxed in RED, the customer name and text been changed.

Leave a comment

Your email address will not be published. Required fields are marked *