Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Mar 15, 2024
1 parent facfa03 commit 856108f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/console/controllers/SkeeksSuppliersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,19 @@ public function options($actionID)
public function init()
{
if (!isset(\Yii::$app->skeeksSuppliersApi)) {
$this->stdout("Компонент skeeksSuppliersApi не подключен");
return false;
throw new Exception("Компонент skeeksSuppliersApi не подключен");
}

if (!\Yii::$app->skeeksSuppliersApi->api_key) {
$this->stdout("Skeeks Suppliers API не настроено, не указан api_key");
return false;
throw new Exception("Skeeks Suppliers API не настроено, не указан api_key");
}

if (!\Yii::$app->shop->contentProducts) {
$this->stdout("Магазин не настроен, не настроен товарный контент");
return false;
throw new Exception("Магазин не настроен, не настроен товарный контент");
}

if (!\Yii::$app->cms->cmsSite->shopSite->catalogMainCmsTree) {
$this->stdout("Магазин не настроен, нет корневого раздела для товаров.");
return false;
throw new Exception("Магазин не настроен, нет корневого раздела для товаров.");
}

return parent::init();
Expand Down Expand Up @@ -701,6 +697,7 @@ private function _updateTree($apiData = [], CmsTree $cmsTree = null)
$cmsTree = new CmsTree();

$cmsTree->sx_id = (int)ArrayHelper::getValue($apiData, "id");

$cmsTree->name = trim((string)ArrayHelper::getValue($apiData, "name"));
$cmsTree->description_short = trim((string)ArrayHelper::getValue($apiData, "description_short"));
$cmsTree->description_full = trim((string)ArrayHelper::getValue($apiData, "description_full"));
Expand Down Expand Up @@ -916,6 +913,7 @@ private function _updateBrand($apiData = [], ShopBrand $model = null)
//Создать
$model = new ShopBrand();

$model->sx_id = (int)ArrayHelper::getValue($apiData, "id");
$model->name = trim((string)ArrayHelper::getValue($apiData, "name"));
$model->website_url = trim((string)ArrayHelper::getValue($apiData, "website_url"));
$model->country_alpha2 = trim((string)ArrayHelper::getValue($apiData, "country_alpha2"));
Expand Down

0 comments on commit 856108f

Please sign in to comment.