Contributions
Edit orders comments
This contribution serves to be able to modify the commentaries of the
orders that the administrator has done to the user on that order. It
is possible to be published and to even erase the commentaries, that
yes, emails that have been sent, those no longer are peuden to erase :)
Expand All / Collapse All
If you delete an existing orders status history entry (with or without comments), the status in the table orders, -> orders_status wasnt updated.
This will fix this bug, just search for:
includes/admin/orders.php
case 'delete_comment_true':
if(isset($HTTP_POST_VARS['comment_id'])){
tep_db_query("DELETE FROM " . TABLE_ORDERS_STATUS_HISTORY . "
where orders_status_history_id = '" . tep_db_input($HTTP_POST_VARS['comment_id']) . "'");
}
Change to:
case 'delete_comment_true':
if(isset($HTTP_POST_VARS['comment_id'])){
tep_db_query("DELETE FROM " . TABLE_ORDERS_STATUS_HISTORY . "
where orders_status_history_id = '" . tep_db_input($HTTP_POST_VARS['comment_id']) . "'");
$osh_id_query = tep_db_query("select MAX(orders_status_history_id) max from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$oID . "'");
$osh_id = tep_db_fetch_array($osh_id_query);
$order_status_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$oID . "' and orders_status_history_id ='" . $osh_id['max'] . "'");
$order_status = tep_db_fetch_array($order_status_query);
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . $order_status['orders_status_id'] . "', last_modified = now() where orders_id = '" . (int)$oID . "'");
}
Thats all, have fun!
Sorry Folks,
The my below has a bug in it where hitting the first two "Update" buttons on the admin/edit_orders.php page will actually add a blank comment.
Currently I'm a updating the page to hold textarea boxes so that we can edit the page just like the address fields and use the existing "update_order" case statement. Otherwise I'll need to write a new html block to accommodate what happens when a comment is added.
IDEA:
* Edit the comments in place.
* Add a delete button to delete the row.
* Feel free to work on my code while I make the fixes.
I posted how I added this contribution to the Order Editor 2.8.2
http://forums.oscommerce.com/index.php?s=&showtopic=54032&view=findpost&p=987257
NOTE: I have grabbed the text from my initial post and made a simple html file within this zip. This is an update and I have not included the other files.
--Duende
The difference between the original contribution and this is the inclusion of orders_status_history_id in the $orders_history_query statement.
Before fixing this bug, I was not able to add, delete, or change comments.
That's it! Enjoy.
This contribution serves to be able to modify the commentaries of the
orders that the administrator has done to the user on that order. It
is possible to be published and to even erase the commentaries, that
yes, emails that have been sent, those no longer are peuden to erase :)
Note: Contributions are used at own risk.