Jump to content



Issue Information

  • #000593

  • 0 - None Assigned

  • New

  • 2.3.2

  • -

Issue Confirmations

  • Yes (0)No (1)
Photo

Add Comments To Your Order

Posted by Chris H on 24 April 2013 - 13:54

Add Comments About Your Order

About the text that is typed into the Comments box. We can trace it as far as

$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

in

checkout_confirmation.php

but no further. This is bit serious. The buyer will be annoyed at the seller's apparent discourtesy, in ignoring a request. Since we no longer put the text into the orders table I have replaced the quoted line with these 2 lines

session_start();
$_SESSION['comments'] = filter_var($HTTP_POST_VARS['comments'], FILTER_SANITIZE_STRING);

and inserted

session_start();
$to_name = 'self';
$to_email_address = 'xxxxxxxxxxxxxxxx@yahoo.co.uk';
$email_subject = 'from website';
$email_text = '';

if (isset($_SESSION['comments']) && tep_not_null($_SESSION['comments'])) {
$email_text = $_SESSION['comments'];
}
$from_email_name = 'Shop Administration';
$from_email_address = 'info@mytepshop.com';

if ($email_text != '') {
tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address);
}


into

checkout_success.php

immediately before

require(DIR_WS_INCLUDES . 'template_top.php');

The email arrives simultaneously with the one from Paypal. So identifying the order, to which the comment relates, is not a problem. But I acknowledge that positive identification would be preferable.

?? Comments about your order are written to the order_status_history table in 2.3.3

$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']);
  tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

This is picked up at $order->info['comments'], which is part of the order class.

Hi

I just posted in the forum regarding a similar problem.
It is possible that customers comments are lost when using paypal standard_ipn.
The comments are not written to the orders_status_history when the order is saved.
See here
http://forums.oscomm...tomer-comments/

Regards

Ken

The checkout_confirmation.php post button form sometimes makes jokes when call again this code:

if ($confirmation = $payment_modules->confirmation()) {

I think this would be response for error.

Well, I found in confirmation() payment module's function this code:

			 tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');


but later is not saved. So Burt suggested code is not found there!

Add after:
		 tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
		 }


this code:
$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']);
tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

Edited by Gergely, 29 June 2013 - 14:00.