diff --git a/classes/order/OrderReturn.php b/classes/order/OrderReturn.php index 96cfd86f1..c141b1051 100644 --- a/classes/order/OrderReturn.php +++ b/classes/order/OrderReturn.php @@ -226,7 +226,7 @@ class OrderReturnCore extends ObjectModel public static function addReturnedQuantity(&$products, $id_order) { $details = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT od.id_order_detail, IFNULL(GREATEST(od.product_quantity_return, ord.product_quantity),0) as qty_returned + SELECT od.id_order_detail, GREATEST(od.product_quantity_return, IFNULL(ord.product_quantity,0)) as qty_returned FROM '._DB_PREFIX_.'order_detail od LEFT JOIN '._DB_PREFIX_.'order_return_detail ord ON ord.id_order_detail = od.id_order_detail