Skip to content

Commit

Permalink
Новые настройки + возможность удаленной скачки файла
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Jun 27, 2019
1 parent 9a523f9 commit 38ed71b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
==============

1.2.1
-----------------
* Новые настройки + возможность удаленной скачки файла

1.2.0
-----------------
* Using composer-config-plugin
Expand Down
45 changes: 36 additions & 9 deletions src/ImportCsvShopContentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@ public function renderConfigForm(ActiveForm $form)
]
);

echo $form->field($this, 'unique_field')->listBox(
array_merge(['' => ' - '], $this->getAvailableFields()), [
'size' => 1,
]);

if ($this->childrenCmsContent)
{
echo $form->field($this, 'matchingChild')->widget(
Expand Down Expand Up @@ -477,10 +472,22 @@ public function import($number, $row)

foreach ($this->matching as $number => $fieldName)
{
//Выбрано соответствие
$is_update_rewrite = true;

if ($fieldName)
{
$this->_initModelByField($element, $fieldName, $row[$number]);
if (is_array($fieldName)) {
$fieldName = $fieldName['code'];
$is_update_rewrite = ArrayHelper::getValue($fieldName, 'is_update_rewrite');
}
if ($element->isNewRecord) {
$this->_initModelByField($element, $fieldName, $row[$number]);
} else {
if ($is_update_rewrite) {
$this->_initModelByField($element, $fieldName, $row[$number]);
}
}

}
}

Expand Down Expand Up @@ -533,8 +540,28 @@ public function import($number, $row)

foreach ($this->matching as $number => $fieldName)
{
//Выбрано соответствие
$is_update_rewrite = true;

if ($fieldName)
{
if (is_array($fieldName)) {
$fieldName = $fieldName['code'];
$is_update_rewrite = ArrayHelper::getValue($fieldName, 'is_update_rewrite');
}

if (!$isUpdate) {
$this->_initModelByFieldAfterSave($element, $fieldName, $row[$number]);
} else {
if ($is_update_rewrite) {
$this->_initModelByFieldAfterSave($element, $fieldName, $row[$number]);
}
}

}


//Выбрано соответствие
/*if ($fieldName)
{
try
{
Expand All @@ -543,7 +570,7 @@ public function import($number, $row)
{
throw new Exception('Ошибка сохранения поля: ' . $fieldName . ": " . $e->getMessage());
}
}
}*/
}

$result->message = $isUpdate === true ? "Товар обновлен" : 'Товар создан' ;
Expand Down

0 comments on commit 38ed71b

Please sign in to comment.