From e9514ea20e315f66b452fc0a2d61e28190e0267b Mon Sep 17 00:00:00 2001 From: Pavel Date: Mon, 17 Feb 2020 11:35:56 +0300 Subject: [PATCH] proper variables initialization --- composer.json | 4 +++- src/include/class-wc-retailcrm-history.php | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index a298fba..c287da6 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,9 @@ } ], "minimum-stability": "dev", - "require": {}, + "require": { + "ext-simplexml": "*" + }, "require-dev": { "ext-json": "*", "ext-mbstring": "*", diff --git a/src/include/class-wc-retailcrm-history.php b/src/include/class-wc-retailcrm-history.php index 422af3b..0dfbf00 100644 --- a/src/include/class-wc-retailcrm-history.php +++ b/src/include/class-wc-retailcrm-history.php @@ -504,9 +504,9 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) : } /** - * @param $item - * @param $order_item - * @param $order_item_id + * @param array $item + * @param \WC_Order_Item $order_item + * @param string $order_item_id * * @throws \Exception */ @@ -648,6 +648,8 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) : if ($product_data) { foreach ($product_data as $key => $product) { + $arItemsNew = array(); + $arItemsOld = array(); $item = retailcrm_get_wc_product($product['offer'][$this->bind_field], $this->retailcrm_settings); if (!$item) { @@ -818,8 +820,11 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) : */ public static function assemblyOrder($orderHistory) { + $fields = array(); + if (file_exists(__DIR__ . '/../config/objects.xml')) { $objects = simplexml_load_file(__DIR__ . '/../config/objects.xml'); + foreach($objects->fields->field as $object) { $fields[(string)$object["group"]][(string)$object["id"]] = (string)$object; }