mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-04-13 05:20:56 +00:00
prevent discount to be higher than total
This commit is contained in:
parent
5108111654
commit
d4f9e0b762
2 changed files with 9 additions and 1 deletions
|
@ -884,6 +884,10 @@ class RetailcrmOrderBuilder
|
|||
);
|
||||
|
||||
$crmOrder['discountManualAmount'] = round($order->total_discounts, 2);
|
||||
|
||||
if (((float) $crmOrder['discountManualAmount']) > ((float) $order_payment['amount'])) {
|
||||
$crmOrder['discountManualAmount'] = $order_payment['amount'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($order_payment)) {
|
||||
|
|
|
@ -500,9 +500,13 @@ class RetailCRM extends Module
|
|||
'createdAt' => RetailcrmTools::verifyDate($params['order']->date_add, 'Y-m-d H:i:s')
|
||||
? $params['order']->date_add : date('Y-m-d H:i:s'),
|
||||
'delivery' => array('cost' => $params['order']->total_shipping),
|
||||
'discountManualAmount' => $params['order']->total_discounts
|
||||
'discountManualAmount' => round($params['order']->total_discounts, 2)
|
||||
);
|
||||
|
||||
if (((float) $order['discountManualAmount']) > ((float) $params['order']->total_paid)) {
|
||||
$crmOrder['discountManualAmount'] = $params['order']->total_paid;
|
||||
}
|
||||
|
||||
try {
|
||||
$orderdb = new Order($params['order']->id);
|
||||
} catch (PrestaShopDatabaseException $exception) {
|
||||
|
|
Loading…
Add table
Reference in a new issue