Post by terrynshed » Thu Apr 05, 2012 7:18 am

Hi,

I was testing my customer order e-mail notification and noticed that the comments left during checkout (using guest or login checkout) are not displayed in this e-mail. Using Opencart 1.5.1.3.

I looked through the order.tpl file and saw that after the 'order details' section it shows:

Code: Select all

  <?php if ($comment) { ?>
    <table class="list">
    <thead>
      <tr>
        <td class="left"><?php echo $text_instruction; ?></td>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="left"><?php echo $comment; ?></td>
      </tr>
    </tbody>
  </table>
  <?php } ?>
Would this be the code that displays the customer comment if they left one?

When I go into my admin panel I see the customer comments, but they never show up on the e-mail notification the customer receives. Maybe this is not suppose to happen, but just wanted to double check.

I may be confusing the customer comments with the instructions field. But I'll keep looking into it.

Thanks,

Terry

New member

Posts

Joined
Fri Jan 20, 2012 5:35 pm

Post by choiboyogg » Fri Apr 06, 2012 6:02 am

I just noticed this too and it is driving me crazy trying to find the fix for it.... please help me when you get the answer! Thanks

Newbie

Posts

Joined
Fri Apr 06, 2012 6:01 am

Post by terrynshed » Fri Apr 06, 2012 6:43 am

I spent some more time on this yesterday and still could not make much sense of it.

I looked in the catalog/model/checkout/order.php file and saw quite a few 'if' statements involving the 'comment'. So if the comment field was blank I imagine it would not display the 'customer comments' text and data. I am way over my head at this point and can not quite follow it all the way through. I'm sure it needs to access the database which is something I am still not that familiar with.

Though the 'new_instruction' field looks fairly straight forward. The reason I bring this up is because I use the Admin E-Mail Extensions so I can receive a modified copy of the admin e-mail that looks similar to the customer e-mail.

In this Admin E-Mail, the customer comments are always displayed. But the field 'new_instructions' is what is being called and displayed (at least in the vqmod). I don't know how the 'instructions' and 'comments' fields are related.

The admin e-mail was more important to me since it displayed the comments from the customer that I could easily see. And this was needed to save time when logging orders.

At this point I am more interested in learning how these two fields work and what the normal behavior should be.

If I find anything else out, (and it's not on this thread), I'll be sure to post here.

Thanks,

Terry

New member

Posts

Joined
Fri Jan 20, 2012 5:35 pm

Post by Photospirit » Wed Apr 11, 2012 2:17 am

Hi,
any update on this issue...I have the same problem...

Thanks, Chris

New member

Posts

Joined
Sat Oct 23, 2010 8:16 pm

Post by Avvici » Wed Apr 11, 2012 4:53 am

This is meant for a customer to fill in comments/instructions about their order for the store owner(s) to see. It was not meant for customers to see. I personally can't understand why I would have any need to see a comment like: " PLEASE SHIP WITH CARE " if that was my comment ;D

However, if you want to make sure that they are being sent in the confirmation email to the customer then do the following: OC version 1.5.2.1 Open: catalog/model/checkout/order.php
Find this line of code

Code: Select all

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

Code: Select all

if ($order_info['comment'] != "") {
				$template->data['comment'] = nl2br($order_info['comment']);
			} else {
				$template->data['comment'] = '';
			}

If you want to do the same for the TEXT MAIL then just use the if ($order_info['comment'] != "") { conditional

This will allow customers to see the instructions they typed into the box on their email.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by Photospirit » Wed Apr 11, 2012 4:16 pm

thanks for the reply. My issue is that I get an error message on the confirmation email:

Notice: Undefined variable: comment in /home/www/web278/html/my-i/catalog/view/theme/RetailUniverse/template/mail/order.tpl on line 108 which is referring to following code:

Code: Select all

<?php if ($comment) { ?>
    <table class="list">
    <thead>
      <tr>
        <td class="left"><?php echo $text_instruction; ?></td>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="left"><?php echo $comment; ?></td>
      </tr>
    </tbody>
  </table>
In addition, I also want to have the "bank details" being submitted when the payment option "bank transfer" is selected. Any idea on that?

thanks, Chris

New member

Posts

Joined
Sat Oct 23, 2010 8:16 pm

Post by Avvici » Wed Apr 11, 2012 4:21 pm

In your control file where I directed you, if you have this code:

Code: Select all

if ($order_info['comment'] != "") {
            $template->data['comment'] = nl2br($order_info['comment']);
         } else {
            $template->data['comment'] = '';
         }
Then you will not receive that error. That code set's up the $comment variable in your template. At the very least it will come through as blank.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by Photospirit » Wed Apr 11, 2012 4:29 pm

thanks, works fine like that.

New member

Posts

Joined
Sat Oct 23, 2010 8:16 pm

Post by Vallagruppen » Fri Jun 15, 2012 6:26 pm

Hi,

I added the changes above to my order.php code, and it does work. But, it replaces the payments instructions that is set in the payment module (variable payments, 3rd party module)

How could i go about to make both visible in the notification email?

I'm running 1.5.3.1

Newbie

Posts

Joined
Wed Feb 15, 2012 12:50 am

Post by Corrall » Fri Mar 08, 2013 7:26 pm

I downloaded a free VqMod which works in 1.5.5.1 and then changed the code which shows the comments to the one listed above and it now shows a box with instructions as well as name, address, shipping, payment method etc

Attachments


Newbie

Posts

Joined
Tue Feb 19, 2013 3:33 am

Post by holinorby » Mon Aug 12, 2013 9:13 pm

Hi all!

I need some help!
I'd like to change order email subject.
I'd like to, if the Payment adress look like this: Company, Tax_ID, Zipcode, City, Adresse and the Shiping adress looks like this: Lastname, Vorname, Zipcode, City, Adress

Can anyone help me ?

Newbie

Posts

Joined
Mon Dec 24, 2012 5:51 pm

Post by CuCi » Wed May 14, 2014 7:38 pm

Building on what avvici -arvixe- wrote,

Code: Select all

//If there is both system generated instruction to customer and customer generated comment, then both instruction and comment separated by a line.
if (($comment && $notify) && ($order_info['comment'] != "")) {
	$template->data['comment'] = nl2br($comment) . '<br><div style="width: 100%; height: 1px; background: #DDDDDD; overflow: hidden;"></div><br>' . 'Your Comments:' . '<br><br>' . nl2br($order_info['comment']);
//Alternatively if there is instruction to customer but no customer generated comment, then only instruction.
} elseif (($comment && $notify) && ($order_info['comment'] == "")) {
	$template->data['comment'] = nl2br($comment);
//Alternatively if there is no instruction to customer but there is customer generated comment, then only comment.
} elseif (!($comment && $notify) && ($order_info['comment'] != "")) {
	$template->data['comment'] = nl2br($order_info['comment']);				
//Otherwise, just blank.
} else {
	$template->data['comment'] = '';
}
The code is a little rough around the edges especially the hard coding of the "You Comments:". That would be turned into a variable and put into the catalog/language/<language>/mail/order.php file.

The characteristics of the separation line including color #DDDDDD is consistent with the style of the table border in the confirmation email. But again, this may be turned into a variable lookup.

Newbie

Posts

Joined
Sun Apr 27, 2014 11:48 pm

Post by Avvici » Thu May 15, 2014 9:30 am

Sorry to be anal but use proper break tags. Use <br /> , not <br> O0

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by raunharman » Tue Oct 06, 2015 3:05 pm

Could you please host the instructions for OpenCart 2.0.1
We are not getting the comments placed by the customer in our copy of the mail nor in the admin panel.

Newbie

Posts

Joined
Sat Sep 19, 2015 4:02 pm

Post by ronnieb » Sat Nov 21, 2015 2:56 am

Bump for 2.1

New member

Posts

Joined
Tue May 24, 2011 3:44 pm

Post by Allenkeith » Thu Oct 20, 2016 2:02 am

For 2.x I changed the following, seems to work very well. I use this to put tracking information
in the email notification instructions field.

Hope this helps.
Keith

//if ($comment && $notify) {
// $data['comment'] = nl2br($comment);
//} else {
// $data['comment'] = '';
//}

// Replaced with the below block
if ($order_info['comment'] != "") {
$data['comment'] = nl2br($order_info['comment']);
} else {
$data['comment'] = '';
}

Newbie

Posts

Joined
Thu Oct 20, 2016 1:58 am

Post by prosenjeet123 » Fri Feb 22, 2019 8:16 pm

Hi Everyone,

Use the below trick if you want to show comments in order detail page of customer.

Just a quick fix (Tested on 3.0.2)
/catalog/controller/account/order.php

Search "$data['histories'] = array();"

Replace 'comment' line inside result.

'comment' => $result['comment']


Thanks

Newbie

Posts

Joined
Tue Feb 19, 2019 8:02 pm
Who is online

Users browsing this forum: Bing [Bot] and 8 guests