From 9e5b1ba2d8c6e496ad53893090875d105bd109f5 Mon Sep 17 00:00:00 2001 From: Frosin Date: Thu, 11 Jul 2019 10:56:24 +0300 Subject: [PATCH 1/2] fixed synchronization when removing or adding products in retailCRM --- .../system/library/retailcrm/RetailcrmHistoryHelper.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php b/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php index 23522d4..8a08e17 100644 --- a/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php +++ b/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php @@ -41,15 +41,13 @@ class RetailcrmHistoryHelper { $orders[$change['order']['id']]['items'][$change['item']['id']] = $change['item']; } - if (isset($change['oldValue']) - && empty($change['oldValue']) + if (empty($change['oldValue']) && $change['field'] == 'order_product' ) { $orders[$change['order']['id']]['items'][$change['item']['id']]['create'] = true; } - if (isset($change['newValue']) - && empty($change['newValue']) + if (empty($change['newValue']) && $change['field'] == 'order_product' ) { $orders[$change['order']['id']]['items'][$change['item']['id']]['delete'] = true; From 0e90d26dee07b7165eeec95136091e4663fa7a57 Mon Sep 17 00:00:00 2001 From: Frosin Date: Fri, 12 Jul 2019 11:43:04 +0300 Subject: [PATCH 2/2] text correction --- src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php b/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php index 8a08e17..274c015 100644 --- a/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php +++ b/src/upload/system/library/retailcrm/RetailcrmHistoryHelper.php @@ -93,7 +93,7 @@ class RetailcrmHistoryHelper { { $customers = array(); foreach ($customerHistory as $change) { - $change['order'] = self::removeEmpty($change['customer']); + $change['customer'] = self::removeEmpty($change['customer']); if(!empty($customers[$change['customer']['id']]) && $customers[$change['customer']['id']]) { $customers[$change['customer']['id']] = array_merge($customers[$change['customer']['id']], $change['customer']);