diff --git a/MoySkladICMLParser.php b/MoySkladICMLParser.php index 4055d20..3c8ced4 100644 --- a/MoySkladICMLParser.php +++ b/MoySkladICMLParser.php @@ -282,17 +282,18 @@ class MoySkladICMLParser } } - if (isset($assortiment['product']['image']['meta']['href'])) { - $url = $assortiment['product']['image']['meta']['href']; - } elseif (isset($assortiment['image']['meta']['href'])) { - $url = $assortiment['image']['meta']['href']; - } else { - $url = ''; - } - if (!empty($this->options['imgur'])) { - if ($url != '') { - $image = $this->requestImage($url); + + if (isset($assortiment['product']['image']['meta']['href'])) { + $imageUrl = $assortiment['product']['image']['meta']['href']; + } elseif (isset($assortiment['image']['meta']['href'])) { + $imageUrl = $assortiment['image']['meta']['href']; + } else { + $imageUrl = ''; + } + + if ($imageUrl != '') { + $image = $this->requestImage($imageUrl); } }