From ff34c7b32ec95552e22f0f7f4c54a1345eb13719 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 12 Oct 2017 15:03:08 +0200 Subject: [PATCH] add mr and dropshipping sended check for invoice --- override/classes/Order.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/override/classes/Order.php b/override/classes/Order.php index 5cfefc84..20f4d9db 100644 --- a/override/classes/Order.php +++ b/override/classes/Order.php @@ -139,6 +139,44 @@ class Order extends OrderCore { ') as $key => $info) { $data[$info['id_order_detail']] = $info['total_send']; } + foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' + SELECT + d.`id_order_detail`, + IF( + (SELECT COUNT(p.`id_order_detail`) + FROM `'._DB_PREFIX_.'mondialrelay_parcel` p + WHERE d.`id_order_detail` = p.`id_order_detail`), + (SELECT SUM(p.`quantity`) + FROM `'._DB_PREFIX_.'mondialrelay_parcel` p + WHERE d.`id_order_detail` = p.`id_order_detail`), + 0 + ) as `total_send` + FROM `'._DB_PREFIX_.'order_detail` d + WHERE d.`id_order_detail` IN ('.implode(',', $ids).') + ') as $key => $info) { + if($data[$info['id_order_detail']]==0){ + $data[$info['id_order_detail']] = $info['total_send']; + } + } + foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' + SELECT + d.`id_order_detail`, + IF( + (SELECT COUNT(p.`id_order_detail`) + FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` p + WHERE d.`id_order_detail` = p.`id_order_detail`), + (SELECT SUM(p.`quantity`) + FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` p + WHERE d.`id_order_detail` = p.`id_order_detail`), + 0 + ) as `total_send` + FROM `'._DB_PREFIX_.'order_detail` d + WHERE d.`id_order_detail` IN ('.implode(',', $ids).') + ') as $key => $info) { + if($data[$info['id_order_detail']]==0){ + $data[$info['id_order_detail']] = $info['total_send']; + } + } return $data; }