mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-29 00:26:06 +03:00
Merge pull request #163 from Frosin/master
fixed synchronization when removing or adding products in retailCRM
This commit is contained in:
commit
90e7c8913c
@ -41,15 +41,13 @@ class RetailcrmHistoryHelper {
|
|||||||
$orders[$change['order']['id']]['items'][$change['item']['id']] = $change['item'];
|
$orders[$change['order']['id']]['items'][$change['item']['id']] = $change['item'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($change['oldValue'])
|
if (empty($change['oldValue'])
|
||||||
&& empty($change['oldValue'])
|
|
||||||
&& $change['field'] == 'order_product'
|
&& $change['field'] == 'order_product'
|
||||||
) {
|
) {
|
||||||
$orders[$change['order']['id']]['items'][$change['item']['id']]['create'] = true;
|
$orders[$change['order']['id']]['items'][$change['item']['id']]['create'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($change['newValue'])
|
if (empty($change['newValue'])
|
||||||
&& empty($change['newValue'])
|
|
||||||
&& $change['field'] == 'order_product'
|
&& $change['field'] == 'order_product'
|
||||||
) {
|
) {
|
||||||
$orders[$change['order']['id']]['items'][$change['item']['id']]['delete'] = true;
|
$orders[$change['order']['id']]['items'][$change['item']['id']]['delete'] = true;
|
||||||
@ -95,7 +93,7 @@ class RetailcrmHistoryHelper {
|
|||||||
{
|
{
|
||||||
$customers = array();
|
$customers = array();
|
||||||
foreach ($customerHistory as $change) {
|
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']]) {
|
if(!empty($customers[$change['customer']['id']]) && $customers[$change['customer']['id']]) {
|
||||||
$customers[$change['customer']['id']] = array_merge($customers[$change['customer']['id']], $change['customer']);
|
$customers[$change['customer']['id']] = array_merge($customers[$change['customer']['id']], $change['customer']);
|
||||||
|
Loading…
Reference in New Issue
Block a user