Get discount use in order

This commit is contained in:
Michael RICOIS 2017-11-29 17:22:21 +01:00
parent 2437dd9d04
commit 78aefa4f1b

View File

@ -42,8 +42,12 @@ class Ant_Refund_Discount extends Module
if ($this->debuglog) file_put_contents(_PS_ROOT_DIR_.'/log/ant_refund_discount.log', 'Discount : '.$orderParams->total_discounts."\n");
if ($this->debuglog) file_put_contents(_PS_ROOT_DIR_.'/log/ant_refund_discount.log', print_r($params, 1), FILE_APPEND);
// Select if a discount is associated to the order
$nbDiscount = Db::getInstance()->getValue("SELECT count(*) AS nb FROM `"._DB_PREFIX_."order_discount` od
WHERE od.`id_order`=".(int)$orderParams->id);
// If we have no discount
if ($orderParams->total_discounts == 0) {
if ($nbDiscount == 0) {
return;
}