Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Dec 1, 2020
1 parent e0fa5b2 commit b0ed724
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/ImportCsvShopContentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ public function import($number, $row)
if (!$shopProduct->save()) {
throw new Exception("Ошибка сохранения shopProduct: ".print_r($shopProduct->errors, true));
}

unset($shopProduct);
}


$element->refresh();

$shopProductIsUpdate = false;
Expand All @@ -412,6 +416,8 @@ public function import($number, $row)
}
}



if ($this->is_save_source_data) {
$data = $this->getRowDataWithHeaders($row);
$shopProductIsUpdate = true;
Expand All @@ -434,14 +440,14 @@ public function import($number, $row)
$this->_initImages($element, $row);

$result->data = $this->matching;
$result->message = ($isUpdate === true ? "Элемент обновлен" : 'Элемент создан');
$result->message = ($isUpdate === true ? "Элемент обновлен " : 'Элемент создан ');

//$element->relatedPropertiesModel->initAllProperties();
//print_r($element->relatedPropertiesModel->toArray());die;
//$rp = Json::encode($element->relatedPropertiesModel->toArray());
$rp = '';
$result->html = <<<HTML
Элемент: <a href="{$element->url}" data-pjax="0" target="_blank">{$element->id}</a>
Товар: <a href="{$element->url}" data-pjax="0" target="_blank">{$element->id}</a>
HTML;
//unset($element->relatedPropertiesModel);
/*foreach ($element->relatedPropertiesModel->properties as $property)
Expand All @@ -457,16 +463,17 @@ public function import($number, $row)

if ($element && !$element->isNewRecord) {
$result->html = <<<HTML
Элемент: <a href="{$element->url}" data-pjax="0" target="_blank">{$element->id}</a>
Товар: <a href="{$element->url}" data-pjax="0" target="_blank">{$element->id}</a>
HTML;
}
}

unset($shopProduct);
unset($rp);
unset($element->cmsSite);
unset($element->shopProduct);
unset($element);



return $result;
}

Expand Down

0 comments on commit b0ed724

Please sign in to comment.