Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

add status history automatically


qwertyjjj

Recommended Posts

Posted

Hi

I have some code in checkout_success.php that adds a row into one of my specific database tables.

What I would like to do is at the same time, create a record in the orders status history with some comments that the user can automatically read when they go to their order history.

I saw in checkout_process.php the following:

tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

I presume that I cannot just add that code to checkout_success as it won't know what the array is so do I have to perform a separate insert statement?

Posted

The $sql_data_array variable is set immediately before that statement in checkout_process.php:

  $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);

You would need to change $insert_id to something that holds the order ID. You would need to set the status appropriately. The now() would stay the same. The $customer_notification would probably change to '0'. You can put mostly arbitrary text in the comments section.

 

You could also do the insert manually if you want, but this method provides good discipline in forcing you to define all the necessary fields.

Always back up before making changes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...