Commit 7c4bd8679d74edb41ea78e62e3718e9caa3b70cb

Authored by Yarik
1 parent 7d10d812

Import browser beta v0.1

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