Merge pull request #280 from sumitwebkul/gli-653

Wrong amount displayed in Order confirmation page in the payment gateways PaymentReturn Hook
This commit is contained in:
Rohit Jain
2022-01-31 16:49:15 +05:30
committed by GitHub
3 changed files with 58 additions and 43 deletions

View File

@@ -1913,18 +1913,22 @@ class OrderCore extends ObjectModel
}
/**
* Get the sum of total_paid_tax_incl of the orders with similar reference
*
* @since 1.5.0.1
* Get the sum of total_paid_tax_incl/advance_paid_amount of the orders with similar reference
* @param integer $getAdvancePaid (send 1 if want total advance paid amount)
* @return float
*/
public function getOrdersTotalPaid()
public function getOrdersTotalPaid($getAdvancePaid = 0)
{
return Db::getInstance()->getValue('
SELECT SUM(total_paid_tax_incl)
FROM `'._DB_PREFIX_.'orders`
WHERE `reference` = \''.pSQL($this->reference).'\'
AND `id_cart` = '.(int)$this->id_cart);
$sql = 'SELECT';
if ($getAdvancePaid) {
$sql .= ' SUM(advance_paid_amount)';
} else {
$sql .= ' SUM(total_paid_tax_incl)';
}
$sql .= 'FROM `'._DB_PREFIX_.'orders` WHERE `reference` = \''.pSQL($this->reference).
'\' AND `id_cart` = '.(int)$this->id_cart;
return Db::getInstance()->getValue($sql);
}
/**