i tweak a little admin/model/customer/order.php to chargeback the stock of products once the status is changed to one of my choice (and of course the previous status didnt already made the chargeback)
to enable it
open admin/model/customer/order.php
search for this function: public function editOrder
and paste this code at the beginning of function, jsut before $this->db->query("UPDATE `" . DB_PREFIX . "order`....
at the moment the status that chargeback are hardcoded into $backarr, i will look forward to put a flag in the order_status edit (even it this means adding a db column)
for the moment just fill the $backarr with the order_status_id that you choose
hope this could be useful
Code: Select all
/*CHARGE BACK*/
$backarr=array(7,8,11,12,13); // these are the status that requires a chargeback (change as you need, you can grab these code from order_status table (order_status_id)
if (in_array((int)$data['order_status_id'], $backarr)) {
$prev_st=$this->db->query("SELECT order_status_id from " . DB_PREFIX . "order where order_id= '" . (int)$order_id . "'");
echo $prev_st->row['order_status_id'];
if ($this->config->get('config_stock_subtract')) {
if (!in_array($prev_st->row['order_status_id'], $backarr)) {
$order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
print_r($order_product_query);
foreach ($order_product_query->rows as $result) {
$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity + " . (int)$result['quantity'] . ") WHERE product_id = '" . (int)$result['product_id'] . "'");
}
}
}
}