$listnum[] = $row['num']; $list = ''; $result_group = $db->query('SELECT group_id FROM ' . $db_config['prefix'] . '_' . $module_data . '_orders_id_group WHERE order_i=' . $row['id']); $group = array(); while (list($group_id) = $result_group->fetch(3)) { $group[] = $group_id; } asort($group); $listgroup[] = implode(',', $group); } // Cong lai san pham trong kho if ($pro_config['active_order_number'] == '0') { product_number_order($listid, $listnum, $listgroup, "+"); } // Tru lai so san pham da ban product_number_sell($listid, $listnum, "-"); // Cap nhat lich su su dung ma giam gia $num = $db->query('SELECT COUNT(*) FROM ' . $db_config['prefix'] . '_' . $module_data . '_coupons_history WHERE order_id = ' . $order_id)->fetchColumn(); if ($num > 0) { $db->query('UPDATE ' . $db_config['prefix'] . '_' . $module_data . '_coupons SET uses_per_coupon_count = uses_per_coupon_count - 1 WHERE order_id = ' . $order_id); $exec = $db->exec("DELETE FROM " . $db_config['prefix'] . "_" . $module_data . "_coupons_history WHERE order_id=" . $order_id); } if (!empty($list_order_i)) { foreach ($list_order_i as $order_i) { $db->query("DELETE FROM " . $db_config['prefix'] . "_" . $module_data . "_orders_id_group WHERE order_i=" . $order_i); } } $exec = $db->exec("DELETE FROM " . $db_config['prefix'] . "_" . $module_data . "_orders_id WHERE order_id=" . $order_id); if ($exec) { $db->query("DELETE FROM " . $db_config['prefix'] . "_" . $module_data . "_orders_id_group WHERE order_i=" . $order_id); $exec = $db->exec("DELETE FROM " . $db_config['prefix'] . "_" . $module_data . "_orders WHERE order_id=" . $order_id . " AND transaction_status < 1");
$listnum[] = $info['num']; $listprice[] = $info['price']; $list = ''; if (!empty($info['group'])) { asort($info['group']); $list = implode(',', $info['group']); } $listgroup[] = $list; } } // Neu khong tat chuc nang dat hang vo han thi tru so sp trong kho if ($pro_config['active_order_number'] == '0') { product_number_order($listid, $listnum, $listgroup); } // Cong vao so luong san pham da ban product_number_sell($listid, $listnum); $checkss = md5($order_id . $global_config['sitekey'] . session_id()); $review_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=payment&order_id=' . $order_id . '&checkss=' . $checkss; if (empty($order_info)) { // Cap nhat lich su su dung ma giam gia if (!empty($array_counpons['code'])) { $db->query('UPDATE ' . $db_config['prefix'] . '_' . $module_data . '_coupons SET uses_per_coupon_count = uses_per_coupon_count + 1 WHERE id = ' . $counpons['id']); $amount = $total_old - $total; $stmt = $db->prepare('INSERT INTO ' . $db_config['prefix'] . '_' . $module_data . '_coupons_history( cid, order_id, amount, date_added ) VALUES ( :cid, :order_id, :amount, ' . NV_CURRENTTIME . ' )'); $stmt->bindParam(':cid', $counpons['id'], PDO::PARAM_INT); $stmt->bindParam(':order_id', $order_id, PDO::PARAM_INT); $stmt->bindParam(':amount', $amount, PDO::PARAM_INT); $stmt->execute(); } // Ghi nhan diem tich luy khach hang if ($total_point > 0 and $pro_config['point_active']) {