Post by philip-ebbeka » Tue Sep 19, 2017 5:59 am

Hello, I'm looking for a solution where I can add the customer's comments to the email confirmation that gets sent out. However when I tried to edit /catalog/model/checkout/order.php to replace this line:

Code: Select all

			if ($comment && $notify) {
				$template->data['comment'] = nl2br($comment);
			} else {
				$template->data['comment'] = '';
			}
with this line:

Code: Select all

			if ($order_info['comment']) {
				$template->$data['comment'] = nl2br($order_info['comment']);
			} else {
				$template->$data['comment'] = '';
			}
The order looks like it processes, but then it will just stall on the order and never load the thank you page. I don't receive an email with the order confirmation either. Any ideas on what is going on or how I can troubleshoot this issue? Thanks!

Newbie

Posts

Joined
Thu Jul 20, 2017 5:17 am

Post by IP_CAM » Tue Sep 19, 2017 10:14 am

Well, why not just use something existing for this?
Ernie ;)
User comments in order email free, OC v.1.5.4 - 1.5.6.5_rc:
https://www.opencart.com/index.php?rout ... n_id=13676

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by philip-ebbeka » Wed Sep 20, 2017 4:07 am

Thanks! That worked like a charm when I went into /catalog/view/theme/*/template/mail/order.tpl and replaced this section:

Code: Select all

<?php if ($comment) { ?>
  <table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
    <thead>
      <tr>
        <td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_instruction; ?></td>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td style="font-size: 12px;	border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $comment; ?></td>
      </tr>
    </tbody>
  </table>
<?php } ?>
with this:

Code: Select all

<?php if (isset($user_comment)) { ?>
  <table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
    <thead>
      <tr>
        <td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;"><?php echo $text_user_comment; ?></td>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><?php echo $user_comment; ?></td>
      </tr>
    </tbody>
  </table>
<?php } ?>
Then I went into /catalog/model/checkout/order.php and replaced this section:

Code: Select all

if ($comment && $notify) {
  $template->data['comment'] = nl2br($comment);
} else {
  $template->data['comment'] = '';
}
with this:

Code: Select all

if ($order_info['comment']) {
  $template->data['user_comment'] = nl2br($order_info['comment']);
} else {
  $template->data['comment'] = '';
}
Then I added this line to be used by order.tpl in the above code:

Code: Select all

$template->data['text_user_comment'] = $language->get('text_new_comment');
after this line:

Code: Select all

$template->data['text_footer'] = $language->get('text_new_footer');

Newbie

Posts

Joined
Thu Jul 20, 2017 5:17 am
Who is online

Users browsing this forum: No registered users and 78 guests