PDA

View Full Version : order_editor_for2.3_v1.0



michael_s
06-10-2011, 01:10 AM
When we edit order with delete order status history but this order can't update order status to last in the order status history

in edit_orders_ajax.php find

//8. Update the orders_status_history table
if ($action == 'delete_comment') {
tep_db_query("DELETE FROM " . TABLE_ORDERS_STATUS_HISTORY . " WHERE orders_status_history_id = '" . $_GET['cID'] . "' AND orders_id = '" . $_GET['oID'] . "'");


Add after:
$lastorderstatus_query=tep_db_query("select orders_status_id from ".TABLE_ORDERS_STATUS_HISTORY." where orders_id='" . $_GET['oID'] . "' order by orders_status_history_id desc limit 1" );
if (tep_db_num_rows($lastorderstatus_query) > 0) {
$lastorderstatus_data = tep_db_fetch_array($lastorderstatus_query);
tep_db_query("UPDATE " . TABLE_ORDERS . " set orders_status='".$lastorderstatus_data['orders_status_id']."' WHERE orders_id = '" . $_GET['oID'] . "'");


++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++

in edit_orders.php find
if (isset($comments_details['delete'])){

$Query = "DELETE FROM " . TABLE_ORDERS_STATUS_HISTORY . "
WHERE orders_id = '" . (int)$oID . "'
AND orders_status_history_id = '$orders_status_history_id';";
tep_db_query($Query);


Add after:
$lastorderstatus_query=tep_db_query("select orders_status_id from ".TABLE_ORDERS_STATUS_HISTORY." where orders_id='" . $_GET['oID'] . "' order by orders_status_history_id desc limit 1" );
if (tep_db_num_rows($lastorderstatus_query) > 0) {
$lastorderstatus_data = tep_db_fetch_array($lastorderstatus_query);
tep_db_query("UPDATE " . TABLE_ORDERS . " set orders_status='".$lastorderstatus_data['orders_status_id']."' WHERE orders_id = '" . $_GET['oID'] . "'");




Please backup backup before do that!


More... (http://addons.oscommerce.com/info/7844)