From e3b0a3cbf50e101557397e6db21058a80028b34b Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 11 Oct 2016 17:28:11 +0300 Subject: [PATCH] -Export/Import -Variants fix --- common/config/main.php | 3 ++- common/modules/product/models/Export.php | 2 +- common/modules/product/models/Import.php | 10 ++++++---- common/modules/product/models/ProductVariant.php | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/common/config/main.php b/common/config/main.php index 3891171..a335b70 100755 --- a/common/config/main.php +++ b/common/config/main.php @@ -231,7 +231,8 @@ 'main_event_one' => [ 'resize' => [ 'width' => 308, - 'height' => 221, + 'height' => 206, + 'master' => yii\image\drivers\Kohana_Image::NONE, ], ], 'product_list_item' => [ diff --git a/common/modules/product/models/Export.php b/common/modules/product/models/Export.php index dae6840..f31cda8 100755 --- a/common/modules/product/models/Export.php +++ b/common/modules/product/models/Export.php @@ -47,7 +47,7 @@ $list = [ $categories, - (!empty($product->size) ? $product->size : ''), + '', $product->name, '', ( ( !empty( $product->description ) ) ? $product->description : '' ), diff --git a/common/modules/product/models/Import.php b/common/modules/product/models/Import.php index 45129a3..30fc16e 100755 --- a/common/modules/product/models/Import.php +++ b/common/modules/product/models/Import.php @@ -220,8 +220,8 @@ class Import extends Model { continue; } - // 4 Описание Укр - $product_body_uk = $data[3]; + // 4 Материал (кастомное поле для Баккары) + $product_material = $data[3]; // 5 Описание Рус $product_body_ru = $data[4]; @@ -231,8 +231,9 @@ class Import extends Model { // 11 Цена акция $product_cost_old = floatval($data[7]); - + // 10 Цена + $product_cost = ''; if ($product_cost_old) { $product_cost_old = floatval($data[6]); $product_cost = floatval($data[7]); @@ -274,7 +275,7 @@ class Import extends Model { foreach($catalog_names as $catalog_name){ // ==== Set category ==== - if ( ($category = Category::find()->filterWhere(['ilike', 'name', trim($catalog_name)])->one()) === null ) { + if ( ($category = Category::find()->filterWhere(['name' => trim($catalog_name)])->one()) === null ) { // Create category $category = new Category(); $category->name = trim($catalog_name); @@ -308,6 +309,7 @@ class Import extends Model { $_product->akciya = $product_akciya; $_product->is_new = $product_new; $_product->size = $product_size; + $_product->material = $product_material; if (!$_product->save()) { $result_items[] = 'Product #'. $_product->name .' not saved' . " (строка $j)"; diff --git a/common/modules/product/models/ProductVariant.php b/common/modules/product/models/ProductVariant.php index 08d761d..f6fb4f7 100755 --- a/common/modules/product/models/ProductVariant.php +++ b/common/modules/product/models/ProductVariant.php @@ -317,7 +317,7 @@ { parent::afterSave($insert, $changedAttributes); $this->unlinkAll('options', true); - $options = TaxOption::findAll($this->_options); + $options = TaxOption::findAll($this->options); foreach($options as $option) { $this->link('options', $option); } -- libgit2 0.21.4