mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-03 19:53:19 +03:00
prevent discount to be higher than total
This commit is contained in:
parent
5108111654
commit
d4f9e0b762
@ -884,6 +884,10 @@ class RetailcrmOrderBuilder
|
|||||||
);
|
);
|
||||||
|
|
||||||
$crmOrder['discountManualAmount'] = round($order->total_discounts, 2);
|
$crmOrder['discountManualAmount'] = round($order->total_discounts, 2);
|
||||||
|
|
||||||
|
if (((float) $crmOrder['discountManualAmount']) > ((float) $order_payment['amount'])) {
|
||||||
|
$crmOrder['discountManualAmount'] = $order_payment['amount'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($order_payment)) {
|
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')
|
'createdAt' => RetailcrmTools::verifyDate($params['order']->date_add, 'Y-m-d H:i:s')
|
||||||
? $params['order']->date_add : date('Y-m-d H:i:s'),
|
? $params['order']->date_add : date('Y-m-d H:i:s'),
|
||||||
'delivery' => array('cost' => $params['order']->total_shipping),
|
'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 {
|
try {
|
||||||
$orderdb = new Order($params['order']->id);
|
$orderdb = new Order($params['order']->id);
|
||||||
} catch (PrestaShopDatabaseException $exception) {
|
} catch (PrestaShopDatabaseException $exception) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user