Commit e3b0a3cbf50e101557397e6db21058a80028b34b
1 parent
427196c7
-Export/Import
-Variants fix
Showing
4 changed files
with
10 additions
and
7 deletions
Show diff stats
common/config/main.php
common/modules/product/models/Export.php
common/modules/product/models/Import.php
| ... | ... | @@ -220,8 +220,8 @@ class Import extends Model { |
| 220 | 220 | continue; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - // 4 Описание Укр | |
| 224 | - $product_body_uk = $data[3]; | |
| 223 | + // 4 Материал (кастомное поле для Баккары) | |
| 224 | + $product_material = $data[3]; | |
| 225 | 225 | |
| 226 | 226 | // 5 Описание Рус |
| 227 | 227 | $product_body_ru = $data[4]; |
| ... | ... | @@ -231,8 +231,9 @@ class Import extends Model { |
| 231 | 231 | |
| 232 | 232 | // 11 Цена акция |
| 233 | 233 | $product_cost_old = floatval($data[7]); |
| 234 | - | |
| 234 | + | |
| 235 | 235 | // 10 Цена |
| 236 | + $product_cost = ''; | |
| 236 | 237 | if ($product_cost_old) { |
| 237 | 238 | $product_cost_old = floatval($data[6]); |
| 238 | 239 | $product_cost = floatval($data[7]); |
| ... | ... | @@ -274,7 +275,7 @@ class Import extends Model { |
| 274 | 275 | |
| 275 | 276 | foreach($catalog_names as $catalog_name){ |
| 276 | 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 | 279 | // Create category |
| 279 | 280 | $category = new Category(); |
| 280 | 281 | $category->name = trim($catalog_name); |
| ... | ... | @@ -308,6 +309,7 @@ class Import extends Model { |
| 308 | 309 | $_product->akciya = $product_akciya; |
| 309 | 310 | $_product->is_new = $product_new; |
| 310 | 311 | $_product->size = $product_size; |
| 312 | + $_product->material = $product_material; | |
| 311 | 313 | |
| 312 | 314 | if (!$_product->save()) { |
| 313 | 315 | $result_items[] = 'Product #'. $_product->name .' not saved' . " (строка $j)"; | ... | ... |
common/modules/product/models/ProductVariant.php
| ... | ... | @@ -317,7 +317,7 @@ |
| 317 | 317 | { |
| 318 | 318 | parent::afterSave($insert, $changedAttributes); |
| 319 | 319 | $this->unlinkAll('options', true); |
| 320 | - $options = TaxOption::findAll($this->_options); | |
| 320 | + $options = TaxOption::findAll($this->options); | |
| 321 | 321 | foreach($options as $option) { |
| 322 | 322 | $this->link('options', $option); |
| 323 | 323 | } | ... | ... |