Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order cancelled


Guest

Recommended Posts

Hi anyone,

How do I put an order back? Some customers order but never paid and i want to refill my stock.

:-"

 

 

 

in admin/orders.php :

 

 

just after :

 

case 'update_order':

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

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

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

 

$order_updated = false;

$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

$check_status = tep_db_fetch_array($check_status_query);

 

if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {

tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");

 

 

 

you add :

 

 

// update stock and status if order is cancelled

 

if ($status == 4){ // 4 = cancelled

$products_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$oID . "'");

while ($ordered_products = tep_db_fetch_array($products_query)) {

$product = $ordered_products['products_id'];

$qty = $ordered_products['products_quantity'];

tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity+'" . $qty . "', products_status = '" . 1 . "' where products_id = '" . $product . "'");

}

}

 

 

 

so when you cancel an order in admin, the ordered quantities get added again and the status of the product is set to enabled.

Treasurer MFC

Link to comment
Share on other sites

Alternatively, just go to Orders, click to Delete that order, and just make sure that the Re-stock Product Quantity box is ticked - which it should be anyway by default.

 

Vger

Link to comment
Share on other sites

Alternatively, just go to Orders, click to Delete that order, and just make sure that the Re-stock Product Quantity box is ticked - which it should be anyway by default.

 

Vger

 

true, but that is for the complete deletion of the order, the order will not show up anymore.

Treasurer MFC

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...