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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user