diff --git a/MoySkladICMLParser.php b/MoySkladICMLParser.php index 9f1f261..153f922 100644 --- a/MoySkladICMLParser.php +++ b/MoySkladICMLParser.php @@ -101,8 +101,11 @@ class MoySkladICMLParser } $icml = $this->ICMLCreate($categories, $assortiment); - - $icml->asXML($this->getFilePath()); + + if (count($categories) > 0 && count($assortiment) > 0) { + $icml->asXML($this->getFilePath()); + } +// $icml->asXML($this->getFilePath()); } @@ -206,7 +209,7 @@ class MoySkladICMLParser break; } } - + $categories = array(); return $categories; } @@ -221,13 +224,19 @@ class MoySkladICMLParser $offset = 0; $end = null; + $url = self::ASSORT_LIST_URL.'?expand='.self::ASSORTIMENT_EXPAND.'&limit='.self::LIMIT; + $ignoreNoCategoryOffers = isset($this->options['ignoreNoCategoryOffers']) && $this->options['ignoreNoCategoryOffers']; $ignoreCategories = $this->getIgnoreProductGroupsInfo(); + if ($this->options['archivedGoods'] == true) { + $url .= '&archived=All'; + } + while (true) { - $response = $this->requestJson(self::ASSORT_LIST_URL.'?expand='.self::ASSORTIMENT_EXPAND.'&limit='.self::LIMIT.'&offset='.$offset); + $response = $this->requestJson($url.'&offset='.$offset); if ($response && $response['rows']) { foreach ($response['rows'] as $assortiment) {