New order comments box not working

Open to all! Ask other shopowners for help.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: New order comments box not working

Post by Pierre_P »

You need to edit comments_new into a few places to actually save it to the database.
example includes/classes/order.php - add the comments_new, same with checkout_payment,
checkout_shipping, checkout_process.php and checkout_confirmation.php
- just find comments and replicate to comments_new

admin/order find example $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified and add comments_new .....
Same page at your table at TABLE_HEADING_COMMENTS, add your new table TABLE_HEADING_COMMENTS_NEW and just futher add new comment code

For admin invoice part something like:

Code: Select all

    if (tep_db_num_rows($orders_history_query)) {
      while ($orders_history = tep_db_fetch_array($orders_history_query)) {
	if (!empty($orders_history['comments_new']) == '') {   ?>
  <td class="main" width="300"><strong>Other Comments:</strong> <?php echo nl2br(tep_db_output($orders_history['comments_new'])); } } } ?> </td>
<?php } ?>
Edit and add the database table orders_status_history
ALTER TABLE `orders_status_history` ADD `comments` longtext DEFAULT NULL;

Stay with comments_new like in checkout_confirmation

Code: Select all

if (tep_not_null($order->info['comments_new'])) {

echo tep_draw_textarea_field('comments_new', 'soft', 60, 5, $comments_new, 'id="inputCommentsNew" placeholder="' . ENTRY_COMMENTS_NEW_PLACEHOLDER . '"');
Just keep proper file backups

From here see the developers to sort out
Hth


Join The Code Co-op to get access to your library in the Code Co-op Forum
Rich-Os
Member
Posts: 21
Joined: Thu Sep 30, 2021 2:03 pm
Phoenix Version:
Has thanked: 5 times

Re: New order comments box not working

Post by Rich-Os »

burt wrote: Thu Apr 17, 2025 9:44 am app.php/developers

Here are 3 developers to get a quote from. Getting a quote costs you nothing other than the time to write an email.

v1050 is very old, so maybe don't expect to too much in the way of help.
Ok, thank you.
Rich-Os
Member
Posts: 21
Joined: Thu Sep 30, 2021 2:03 pm
Phoenix Version:
Has thanked: 5 times

Re: New order comments box not working

Post by Rich-Os »

Pierre_P wrote: Thu Apr 17, 2025 4:06 pm You need to edit comments_new into a few places to actually save it to the database.
example includes/classes/order.php - add the comments_new, same with checkout_payment,
checkout_shipping, checkout_process.php and checkout_confirmation.php
- just find comments and replicate to comments_new
Thank you so much @Pierre_P for the effort made to explain what I needed to do.
I missed some instances of "comments" to edit before. I have been able to change all except those in payments addons like Paypal (because I don't think they matter. They're "select" calls).
The comments_new appears in all the 3 processing pages. It's just not saving to the database.
It seems like a dead end. I might need to do some re-evaluation.
Many thanks @Pierre_P .

Regards,
Rich-Os
Rich-Os
Member
Posts: 21
Joined: Thu Sep 30, 2021 2:03 pm
Phoenix Version:
Has thanked: 5 times

Re: New order comments box not working

Post by Rich-Os »

Update:

I might be wrong about this but it looks like the hooks calling the insert query to update the database table is buggy.

I still can't get the comments_new value to be saved in the database table despite the comment_new appearing in all the 3 checkout pages (shipping, payment & confirmation). If I manually enter texts into the comments_new database table, it will show up in the account_history_info.php page which means the database table is good.

Below is the log from mysql. It shows the comment_new's value in the insert query not being passed on from session's update query by hooks's call.

Code: Select all

4348 Query	insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments, comments_new) values ('41', '1', now(), '1', 'Wrap my order very well', '')
This log entry below showed session's update query still showing the cached comment_new's value.

Code: Select all

4351 Query	update sessions set expiry = '1745927942', value = 'sessiontoken|s:32:\"f756a8c599de67d95d7bf7e98cfd2dc0\";cart|O:12:\"shoppingCart\":5:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:6:\"cartID\";N;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"EUR\";navigation|O:17:\"navigationHistory\":2:{s:4:\"path\";a:8:{i:0;a:4:{s:4:\"page\";s:9:\"index.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:0:{}}i:1;a:4:{s:4:\"page\";s:16:\"product_info.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:3:{s:11:\"products_id\";s:4:\"1119\";s:6:\"action\";s:11:\"add_product\";s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:2:{s:2:\"id\";a:5:{i:63;s:3:\"464\";i:37;s:3:\"191\";i:42;s:3:\"246\";i:15;s:2:\"30\";i:20;s:3:\"186\";}s:11:\"products_id\";s:4:\"1119\";}}i:2;a:4:{s:4:\"page\";s:17:\"shopping_cart.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:0:{}}i:3;a:4:{s:4:\"page\";s:21:\"checkout_shipping.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:5:{s:6:\"formid\";s:32:\"f756a8c599de67d95d7bf7e98cfd2dc0\";s:6:\"action\";s:7:\"process\";s:8:\"shipping\";s:11:\"table_table\";s:8:\"comments\";s:23:\"Wrap my order very well\";s:16:\"comments_new\";s:15:\"Happy Birthday!\";}}i:4;a:4:{s:4:\"page\";s:20:\"checkout_payment.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:0:{}}i:5;a:4:{s:4:\"page\";s:25:\"checkout_confirmation.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:1:{s:9:\"btnSubmit\";s:12:\"Upload Files\";}}i:6;a:4:{s:4:\"page\";s:20:\"checkout_process.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:2:{s:8:\"comments\";s:23:\"Wrap my order very well\";s:16:\"comments_new\";s:15:\"Happy Birthday!\";}}i:7;a:4:{s:4:\"page\";s:20:\"checkout_success.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:4:\"ceid\";s:26:\"big6m1u15nadf0d5nnrbbkoid9\";}s:4:\"post\";a:0:{}}}s:8:\"snapshot\";a:0:{}}customer_id|i:1;customer_default_address_id|s:1:\"1\";customer_first_name|s:7:\"Richard\";customer_country_id|s:3:\"150\";customer_zone_id|s:1:\"0\";recently_viewed|s:4:\"1119\";new_products_id_in_cart|i:1119;' where sesskey = 'big6m1u15nadf0d5nnrbbkoid9'
tep_db_perform code in checkout_process.php

Code: Select all

  $sql_data_array = array('orders_id' => $insert_id, 
                          'orders_status_id' => $order->info['order_status'], 
                          'date_added' => 'now()', 
                          'customer_notified' => $customer_notification,
                          'comments' => $order->info['comments'],
                          'comments_new' => $order->info['comments_new']);	 	//added for comments_new				  
  tep_db_perform('orders_status_history', $sql_data_array);
@burt, I'm sure I've duplicated all instances of 'comments' to 'comments_new' without error.
If hooks's insert query is buggy, where is it defined so I can include missing variables?


Thanking you all in advance.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: New order comments box not working

Post by ecartz »

Rich-Os wrote: Tue May 13, 2025 12:30 pm tep_db_perform code in checkout_process.php

Code: Select all

  $sql_data_array = array('orders_id' => $insert_id, 
                          'orders_status_id' => $order->info['order_status'], 
                          'date_added' => 'now()', 
                          'customer_notified' => $customer_notification,
                          'comments' => $order->info['comments'],
                          'comments_new' => $order->info['comments_new']);	 	//added for comments_new				  
  tep_db_perform('orders_status_history', $sql_data_array);
How old a version are you using?

It looks like it is older than the hooks. I'm guessing that you don't have anything like https://github.com/CE-PhoenixCart/Phoen ... r.php#L140 which is why it isn't working.

It looks like you'd have to update to 1.0.7.0 (already five years old) to get the hooks.
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: New order comments box not working

Post by burt »

Rich-Os is on v1.0.5.0, after a couple of posts of getting nowhere, I advised to get a quote from Certified Developers if he could not get it to work. v1.0.5.0 is so old that I can't install a working version to help further, even if I wanted to.

Anyway, after "get a quote" advice was given, the issue was clouded by other well meaning comments. I am not sure if a quote was asked for, or if it was was it too expensive or some other reason.
I am not here to build for you.
I am here to build with you. Let's help each other.
Rich-Os
Member
Posts: 21
Joined: Thu Sep 30, 2021 2:03 pm
Phoenix Version:
Has thanked: 5 times

Re: New order comments box not working

Post by Rich-Os »

ecartz wrote: Tue May 13, 2025 3:14 pm
Rich-Os wrote: Tue May 13, 2025 12:30 pm
How old a version are you using?

It looks like it is older than the hooks.

It looks like you'd have to update to 1.0.7.0 (already five years old) to get the hooks.
@ecartz, I appreciate your reply.

I'm on v1.0.5.0.

Yes, it's an old version but I believe that hooks is on it already because I could read in mysql log that it is responsible for populating the database tables, I believe.

May be @burt just doesn't want to reveal the secret behind it :) :) . But I reckon I deserve the support after putting in the work to get it all (except populating the database table) sorted out. But, you know....

Thank you
Rich-Os
Member
Posts: 21
Joined: Thu Sep 30, 2021 2:03 pm
Phoenix Version:
Has thanked: 5 times

Re: New order comments box not working

Post by Rich-Os »

burt wrote: Tue May 13, 2025 3:30 pm Rich-Os is on v1.0.5.0, after a couple of posts of getting nowhere, I advised to get a quote from Certified Developers if he could not get it to work. v1.0.5.0 is so old that I can't install a working version to help further, even if I wanted to.

Anyway, after "get a quote" advice was given, the issue was clouded by other well meaning comments. I am not sure if a quote was asked for, or if it was was it too expensive or some other reason.
Thank you @burt.

I didn't miss your advice to get a quote from Certified Developers. I just haven't done it yet because, yes, I'm not sure of the kind of response I would get and I feel like I am so close to getting there even if I'm not, in reality. You know better.

More importantly, I didn't realize that there is still so much work to do (identifying how the database is populated in this case) I want to learn and I'm not afraid to dig in, put my head down and improve myself in the process. I thought you appreciate that kind of willingness, readiness & get-up-and-go mentality.

Before deciding to give this extra comments box a go, I wanted to purchase the addon by @raiwa for managing order options (which includes texts and files upload functions). The addon is meant for 1.0.8 version and above. I kindly requested for his assistance to point me in the right direction to make it work for my version. I told him I was ready to put in the work. @raiwa said he was too busy to help with giving me pointers to make the addon work for my version. @raiwa is a great guy and I respected his decision. So, I decided to give it a go and this is where that got me.

Also, a couple of times in the past, I wanted to purchase other addons, including another one from @raiwa. I came across the same problem - the unwillingness to give support. Although, it is clear that some people on this platform are still doing their best to support others. My sincere appreciation to them.

Thanks, again.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: New order comments box not working

Post by heatherbell »

Rich-Os wrote: Thu May 15, 2025 10:41 amunwillingness to give support.
With all goodwill, what you're referring to as "support" could be considered as "development".
Addons are generally supplied 'as is' and asking for help to adapt an addon to an unsupported version would generally be considered as an extra, paid for development service. It would possibly take more time for a developer to guide someone to adapt an addon than to actually do the work.
Otherwise, it could be considered as asking someone to give their business time for free to develop your business.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: New order comments box not working

Post by ecartz »

Rich-Os wrote: Thu May 15, 2025 10:30 am I believe that hooks is on it already because I could read in mysql log that it is responsible for populating the database tables, I believe.
There are hooks in 1.0.5.0. The specific hooks that people are talking about using for the database table insertion during checkout didn't exist then. They were added in 1.0.7.9 or some version like that (it's difficult even to pin down the version now, as the file that I originally used no longer exists).

Updating from 1.0.5.0 to 1.0.7.9 or 1.0.8.0 or even 1.1.0.3 is straightforward if time consuming. There are directions for each individual update. Backpatching instructions to 1.0.5.0 or even 1.0.7.9 or 1.0.8.0 is less straightforward. As Burt noted, he can't even install 1.0.5.0 on his system anymore because it required a version of PHP that is no longer available. Further, if you backpatch to an older version, you may find yourself making core changes because the hooks are not available yet. In this case, I had to rewrite how tables were inserted into the database to create the hookpoint that people are suggesting you use. Backpatching isn't as simple as adding the hook. You would need to update the portion of the code that inserts into the database to be compatible with the hook. Core changes make it harder to do updates later.

Any of the certified developers could help you with that, but ozeworks is the only one who advertises that they do it.


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