Include Customer Name & Phone Number In Order Email

ThemeBurn SupportForumsOpenCart ThemesShoppica OpenCart ThemeInclude Customer Name & Phone Number In Order Email

This topic has been marked as resolved.

Hi there,

Is there a possibility to include the customer name and phone number into the order email template? I’ve tried the solutions from the OC forum but I am still unable to make it to work.

It would be great if you could help.

Thanks.

 3antz
November 21, 2011 at 2:30 pm #3758

Hi,
in order to achieve this, you need to make modifications in catalog/model/checkout/order.php. The method responsible for the email is public function confirm(). Find this row $template->data['ip'] = $order_info['ip']; and insert this after it:

$template->data['order_info'] = $order_info;

Then in your template catalog/view/theme/default/template/mail/order.tpl you can display the name and the phone like so:

<?php echo $order_info['firstname']; ?>
<?php echo $order_info['lastname']; ?>
<?php echo $order_info['telephone']; ?>

I didn’t test this, so I hope it would work.

Regards!

November 25, 2011 at 11:04 am #3846

sorry i meant to say in the subject title of the order confirmation. Currently the title is MyStore – Order 5340 . Is it possible to change it to something like MyStore – Order 5340 – John Doe – 1234567 ? 1234567 being the phone number

I really appreaciate your help on this matter even though this may not be theme related. really a big thank you.

 3antz
November 25, 2011 at 6:14 pm #3848

Yes, this question is not related to Shoppica, but I will try to give you some hints.

You must first edit the language file catalog/language/english/mail/order.php
Change

$_['text_new_subject']          = '%s - Order %s';
to

$_['text_new_subject']          = '%s - Order %s - %s - %s';

Then open catalog/model/checkout/order.php in order to change the email title/subject. GoTo line 212, which should contain:

$subject = sprintf($language->get('text_new_subject'), $order_info['store_name'], $order_id);
and change it to:

$subject = sprintf($language->get('text_new_subject'), $order_info['store_name'], $order_id, $order_info['firstname'] . $order_info['lastname'], $order_info['telephone']);
Then GoTo line 217, which should contain:

$template->data['title'] = sprintf($language->get('text_new_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_id);
and change it to:

$template->data['title'] = sprintf($language->get('text_new_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_id, $order_info['firstname'] . $order_info['lastname'], $order_info['telephone']);

Check if this works.

November 28, 2011 at 11:15 am #3912

Thanks!!!!! Very very happy now.
That solves it. I really appreciate your help.

 3antz
November 28, 2011 at 11:44 am #3914

No problem, mate :)

November 28, 2011 at 12:20 pm #3922
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.