Commit e3b0a3cbf50e101557397e6db21058a80028b34b

Authored by Alexey Boroda
1 parent 427196c7

-Export/Import

-Variants fix
common/config/main.php
@@ -231,7 +231,8 @@ @@ -231,7 +231,8 @@
231 'main_event_one' => [ 231 'main_event_one' => [
232 'resize' => [ 232 'resize' => [
233 'width' => 308, 233 'width' => 308,
234 - 'height' => 221, 234 + 'height' => 206,
  235 + 'master' => yii\image\drivers\Kohana_Image::NONE,
235 ], 236 ],
236 ], 237 ],
237 'product_list_item' => [ 238 'product_list_item' => [
common/modules/product/models/Export.php
@@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
47 47
48 $list = [ 48 $list = [
49 $categories, 49 $categories,
50 - (!empty($product->size) ? $product->size : ''), 50 + '',
51 $product->name, 51 $product->name,
52 '', 52 '',
53 ( ( !empty( $product->description ) ) ? $product->description : '' ), 53 ( ( !empty( $product->description ) ) ? $product->description : '' ),
common/modules/product/models/Import.php
@@ -220,8 +220,8 @@ class Import extends Model { @@ -220,8 +220,8 @@ class Import extends Model {
220 continue; 220 continue;
221 } 221 }
222 222
223 - // 4 Описание Укр  
224 - $product_body_uk = $data[3]; 223 + // 4 Материал (кастомное поле для Баккары)
  224 + $product_material = $data[3];
225 225
226 // 5 Описание Рус 226 // 5 Описание Рус
227 $product_body_ru = $data[4]; 227 $product_body_ru = $data[4];
@@ -231,8 +231,9 @@ class Import extends Model { @@ -231,8 +231,9 @@ class Import extends Model {
231 231
232 // 11 Цена акция 232 // 11 Цена акция
233 $product_cost_old = floatval($data[7]); 233 $product_cost_old = floatval($data[7]);
234 - 234 +
235 // 10 Цена 235 // 10 Цена
  236 + $product_cost = '';
236 if ($product_cost_old) { 237 if ($product_cost_old) {
237 $product_cost_old = floatval($data[6]); 238 $product_cost_old = floatval($data[6]);
238 $product_cost = floatval($data[7]); 239 $product_cost = floatval($data[7]);
@@ -274,7 +275,7 @@ class Import extends Model { @@ -274,7 +275,7 @@ class Import extends Model {
274 275
275 foreach($catalog_names as $catalog_name){ 276 foreach($catalog_names as $catalog_name){
276 // ==== Set category ==== 277 // ==== Set category ====
277 - if ( ($category = Category::find()->filterWhere(['ilike', 'name', trim($catalog_name)])->one()) === null ) { 278 + if ( ($category = Category::find()->filterWhere(['name' => trim($catalog_name)])->one()) === null ) {
278 // Create category 279 // Create category
279 $category = new Category(); 280 $category = new Category();
280 $category->name = trim($catalog_name); 281 $category->name = trim($catalog_name);
@@ -308,6 +309,7 @@ class Import extends Model { @@ -308,6 +309,7 @@ class Import extends Model {
308 $_product->akciya = $product_akciya; 309 $_product->akciya = $product_akciya;
309 $_product->is_new = $product_new; 310 $_product->is_new = $product_new;
310 $_product->size = $product_size; 311 $_product->size = $product_size;
  312 + $_product->material = $product_material;
311 313
312 if (!$_product->save()) { 314 if (!$_product->save()) {
313 $result_items[] = 'Product #'. $_product->name .' not saved' . " (строка $j)"; 315 $result_items[] = 'Product #'. $_product->name .' not saved' . " (строка $j)";
common/modules/product/models/ProductVariant.php
@@ -317,7 +317,7 @@ @@ -317,7 +317,7 @@
317 { 317 {
318 parent::afterSave($insert, $changedAttributes); 318 parent::afterSave($insert, $changedAttributes);
319 $this->unlinkAll('options', true); 319 $this->unlinkAll('options', true);
320 - $options = TaxOption::findAll($this->_options); 320 + $options = TaxOption::findAll($this->options);
321 foreach($options as $option) { 321 foreach($options as $option) {
322 $this->link('options', $option); 322 $this->link('options', $option);
323 } 323 }