Commit 7c4bd8679d74edb41ea78e62e3718e9caa3b70cb
1 parent
7d10d812
Import browser beta v0.1
Showing
2 changed files
with
17 additions
and
17 deletions
Show diff stats
common/modules/language/behaviors/LanguageBehavior.php
common/modules/product/models/Import.php
| ... | ... | @@ -128,7 +128,7 @@ |
| 128 | 128 | // Create stock |
| 129 | 129 | $stock = new Stock(); |
| 130 | 130 | $stock->name = trim($city_name); |
| 131 | - $stock->save(); | |
| 131 | + $stock->save(false); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $productStock = ProductStock::find() |
| ... | ... | @@ -145,7 +145,7 @@ |
| 145 | 145 | } |
| 146 | 146 | $productStock->quantity = $count; |
| 147 | 147 | |
| 148 | - $productStock->save(); | |
| 148 | + $productStock->save(false); | |
| 149 | 149 | $productStocks = ProductStock::find() |
| 150 | 150 | ->where([ 'product_variant_id' => $productVariant->product_variant_id ]) |
| 151 | 151 | ->andWhere([ |
| ... | ... | @@ -180,7 +180,7 @@ |
| 180 | 180 | |
| 181 | 181 | $productVariant->stock = $quantity; |
| 182 | 182 | |
| 183 | - $productVariant->save(); | |
| 183 | + $productVariant->save(false); | |
| 184 | 184 | |
| 185 | 185 | $this->output[] = '<font style="color:blue">Товар ' . $product_title . ' успешно сохранен</font>'; |
| 186 | 186 | } |
| ... | ... | @@ -244,7 +244,7 @@ |
| 244 | 244 | ) { |
| 245 | 245 | if(!empty( $category->lang )) { |
| 246 | 246 | $category->lang->name = $parsed_name[ 'name' ]; |
| 247 | - $category->lang->save(); | |
| 247 | + $category->lang->save(false); | |
| 248 | 248 | } else { |
| 249 | 249 | throw new \Exception('Category with ID ' . $category->category_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist'); |
| 250 | 250 | } |
| ... | ... | @@ -258,7 +258,7 @@ |
| 258 | 258 | $category_lang->name = $parsed_name[ 'name' ]; |
| 259 | 259 | } |
| 260 | 260 | $category->remote_id = $parsed_name[ 'remote_id' ]; |
| 261 | - $category->save(); | |
| 261 | + $category->save(false); | |
| 262 | 262 | } |
| 263 | 263 | $category_id[] = $category->category_id; |
| 264 | 264 | } |
| ... | ... | @@ -286,7 +286,7 @@ |
| 286 | 286 | ) { |
| 287 | 287 | if(!empty( $brand->lang )) { |
| 288 | 288 | $brand->lang->name = $parsed_name[ 'name' ]; |
| 289 | - $brand->lang->save(); | |
| 289 | + $brand->lang->save(false); | |
| 290 | 290 | } else { |
| 291 | 291 | throw new \Exception('Brand with ID ' . $brand->brand_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist'); |
| 292 | 292 | } |
| ... | ... | @@ -300,7 +300,7 @@ |
| 300 | 300 | $brand_lang->name = $parsed_name[ 'name' ]; |
| 301 | 301 | } |
| 302 | 302 | $brand->remote_id = $parsed_name[ 'remote_id' ]; |
| 303 | - $brand->save(); | |
| 303 | + $brand->save(false); | |
| 304 | 304 | return $brand->brand_id; |
| 305 | 305 | } |
| 306 | 306 | } |
| ... | ... | @@ -329,7 +329,7 @@ |
| 329 | 329 | $productImage->product_id = $product_id; |
| 330 | 330 | $productImage->product_variant_id = $product_variant_id; |
| 331 | 331 | $productImage->image = $foto; |
| 332 | - $productImage->save(); | |
| 332 | + $productImage->save(false); | |
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | } |
| ... | ... | @@ -381,7 +381,7 @@ |
| 381 | 381 | } else { |
| 382 | 382 | if(!empty( $_productVariant->lang )) { |
| 383 | 383 | $_productVariant->lang->name = $mod_name; |
| 384 | - $_productVariant->lang->save(); | |
| 384 | + $_productVariant->lang->save(false); | |
| 385 | 385 | } else { |
| 386 | 386 | throw new \Exception('Product variant with ID ' . $_productVariant->product_variant_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist'); |
| 387 | 387 | } |
| ... | ... | @@ -539,7 +539,7 @@ |
| 539 | 539 | if(!empty( $_product->lang )) { |
| 540 | 540 | $_product->lang->name = $parsed_name[ 'name' ]; |
| 541 | 541 | $_product->lang->description = $product_body; |
| 542 | - $_product->lang->save(); | |
| 542 | + $_product->lang->save(false); | |
| 543 | 543 | } else { |
| 544 | 544 | throw new \Exception('Product with ID ' . $_product->product_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist'); |
| 545 | 545 | } |
| ... | ... | @@ -573,7 +573,7 @@ |
| 573 | 573 | $product_name_inserted = $_product->model_langs[ Language::$current->language_id ]->name; |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | - if(($_product->save() === false) || !$_product->transactionStatus) { | |
| 576 | + if(($_product->save(false) === false) || !$_product->transactionStatus) { | |
| 577 | 577 | $result_items[] = 'Product #' . $product_name_inserted . ' not saved' . " (line $j)"; |
| 578 | 578 | continue; |
| 579 | 579 | } |
| ... | ... | @@ -583,7 +583,7 @@ |
| 583 | 583 | |
| 584 | 584 | $this->saveVariants($data, $product_cost_old, $_product->product_id, $_product->categories, $product_cost); |
| 585 | 585 | |
| 586 | -// $_product->save(); | |
| 586 | +// $_product->save(false); | |
| 587 | 587 | |
| 588 | 588 | $result_items[] = "Product {$product_name_inserted} #{$_product->product_id} saved (" . ( $is_new_product ? 'new product' : 'exists product' ) . ")" . " (line $j)"; |
| 589 | 589 | |
| ... | ... | @@ -652,7 +652,7 @@ |
| 652 | 652 | ) { |
| 653 | 653 | if(!empty( $taxGroup->lang )) { |
| 654 | 654 | $taxGroup->lang->name = $parsed_group_name[ 'name' ]; |
| 655 | - $taxGroup->lang->save(); | |
| 655 | + $taxGroup->lang->save(false); | |
| 656 | 656 | } else { |
| 657 | 657 | throw new \Exception('Tax group with ID ' . $taxGroup->tax_group_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist'); |
| 658 | 658 | } |
| ... | ... | @@ -666,7 +666,7 @@ |
| 666 | 666 | $taxGroup->level = $level; |
| 667 | 667 | $taxGroup->categories = $catalog_names; |
| 668 | 668 | $taxGroup->is_filter = false; |
| 669 | - $taxGroup->save(); | |
| 669 | + $taxGroup->save(false); | |
| 670 | 670 | } |
| 671 | 671 | $filters_options = explode(',', $filter[ 2 ][ 0 ]); |
| 672 | 672 | foreach($filters_options as $filter_options) { |
| ... | ... | @@ -683,7 +683,7 @@ |
| 683 | 683 | ) { |
| 684 | 684 | if(!empty( $option->lang )) { |
| 685 | 685 | $option->lang->value = $parsed_option_name[ 'name' ]; |
| 686 | - $option->lang->save(); | |
| 686 | + $option->lang->save(false); | |
| 687 | 687 | } else { |
| 688 | 688 | throw new \Exception('Tax option with ID ' . $option->tax_option_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist'); |
| 689 | 689 | } |
| ... | ... | @@ -696,7 +696,7 @@ |
| 696 | 696 | $option_lang->value = $parsed_option_name[ 'name' ]; |
| 697 | 697 | } |
| 698 | 698 | $option->tax_group_id = $taxGroup->tax_group_id; |
| 699 | - $option->save(); | |
| 699 | + $option->save(false); | |
| 700 | 700 | } |
| 701 | 701 | $options[] = $option->tax_option_id; |
| 702 | 702 | } | ... | ... |