Comments not posting to Order Confirmation email

Open to all! Ask other shopowners for help.
Post Reply
otgrouch
Member
Posts: 13
Joined: Wed Dec 06, 2023 4:27 pm
Phoenix Version:

Comments not posting to Order Confirmation email

Post by otgrouch »

1.0.9.9 store running php 8.3.17

Recently migrated from osc 2.3.4.1 CE

When an order is placed, the order confirmation email is not listing the order comments. The comments are posting to the db and show in the order history. Looking at tpl_n_checkout.php, the code looks very similar to the code used in CE (a few changes, presumably to account for php updates)...but the comments were posting to the email in CE.

Relevant Phoenix code:
if (!empty($order->info['comments'])) {
echo htmlspecialchars($order->info['comments']) . "\n";

Previous OSC code:
if ($order->info['comments']) {
$email_order .= tep_db_output($order->info['comments']) . "\n\n";


The only change I can see in the process is that previously the comments block was listed on every step of the checkout process with a text of the comments on the confirmation page, while the new way has the comment entry block only on the confirmation page.

I found this thread that seems to be pointing to the same issue, but there was no resolution.

viewtopic.php?f=10&t=848&p=6409&hilit=c ... ents#p6409

Thank you for any input.


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Comments not posting to Order Confirmation email

Post by heatherbell »

otgrouch wrote: Thu Mar 13, 2025 5:48 pm Thank you for any input.
Have not yet found an answer but have just tested on latest 1.1.0.0 and confirm this issue persists.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Comments not posting to Order Confirmation email

Post by burt »

Probably something to do with the recent changes in this area when the input box was removed from most of the checkout pages. Override the file and use $_SESSION['comments'] ?
I am not here to build for you.
I am here to build with you. Let's help each other.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Comments not posting to Order Confirmation email

Post by heatherbell »

otgrouch wrote: Thu Mar 13, 2025 5:48 pm

Code: Select all

  if (!empty($order->info['comments'])) {
   echo htmlspecialchars($order->info['comments']) . "\n";
After a lot of testing, change that code to:

Code: Select all

echo htmlspecialchars($_POST['comments']) . "\n\n";
Note this removes the "if" condition.
Tested with no comments entered and with comments entered.
In both cases, the e-mail received by the customer works as expected.

Screenshot 2025-03-16 062101.png
You do not have the required permissions to view the files attached to this post.
mohawk
Posts: 3
Joined: Fri Mar 28, 2025 2:56 pm
Phoenix Version:

Re: Comments not posting to Order Confirmation email

Post by mohawk »

Hi,
My notes are not containing customer comments.
I can see the notes above
if (!empty($order->info['comments'])) {
echo htmlspecialchars($order->info['comments']) . "\n";

and change this to
echo htmlspecialchars($_POST['comments']) . "\n\n";

I am not a coding guy, and the website is working fine. However I will be asking my customers to tell me what size they want in the comments.

Hopefully the above works, but can someone tell me what table this is in please.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Comments not posting to Order Confirmation email

Post by heatherbell »

mohawk wrote: Sun Mar 30, 2025 3:43 pm Hopefully the above works, but can someone tell me what table this is in please.
The change was made in the file - tpl_n_checkout.php
Use your host control panel or use FTP to edit that file which can be found here - /includes/modules/notifications/templates/tpl_n_checkout.php

You will see the lines to be changed - https://github.com/CE-PhoenixCart/Phoen ... hp#L21-L23

Change that code as detailed in my previous post.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply