Commit 4fb5e6c31e0217437d84333c14c03cd2c16a9134

Authored by Yarik
1 parent ee6de78b

Import browser beta v0.1

common/modules/product/models/Import.php
@@ -533,7 +533,6 @@ @@ -533,7 +533,6 @@
533 /** 533 /**
534 * @var Product $_product 534 * @var Product $_product
535 */ 535 */
536 -  
537 if(!empty( $parsed_name[ 'remote_id' ] ) && ( $_product = Product::find() 536 if(!empty( $parsed_name[ 'remote_id' ] ) && ( $_product = Product::find()
538 ->joinWith('lang') 537 ->joinWith('lang')
539 ->andFilterWhere([ 'remote_id' => $parsed_name[ 'remote_id' ] ]) 538 ->andFilterWhere([ 'remote_id' => $parsed_name[ 'remote_id' ] ])
@@ -575,6 +574,9 @@ @@ -575,6 +574,9 @@
575 } else { 574 } else {
576 $product_name_inserted = $_product->model_langs[ Language::$current->language_id ]->name; 575 $product_name_inserted = $_product->model_langs[ Language::$current->language_id ]->name;
577 } 576 }
  577 +
  578 + $_product->validate();
  579 + die(var_dump($_product->getErrors()));
578 580
579 var_dump($_product->save()); die(); 581 var_dump($_product->save()); die();
580 if(!$_product->transactionStatus) { 582 if(!$_product->transactionStatus) {
common/modules/product/models/Product.php
@@ -157,6 +157,15 @@ @@ -157,6 +157,15 @@
157 return $this->hasOne(Brand::className(), [ 'brand_id' => 'brand_id' ]); 157 return $this->hasOne(Brand::className(), [ 'brand_id' => 'brand_id' ]);
158 } 158 }
159 159
  160 +
  161 +
  162 + public function beforeValidate()
  163 + {
  164 + if(parent::beforeValidate()){
  165 + die('here');
  166 + }
  167 + }
  168 +
160 /** 169 /**
161 * @return \yii\db\ActiveQuery 170 * @return \yii\db\ActiveQuery
162 */ 171 */
@@ -345,18 +354,6 @@ @@ -345,18 +354,6 @@
345 ->sum('quantity'); 354 ->sum('quantity');
346 } 355 }
347 356
348 - public function beforeSave($insert)  
349 - {  
350 -  
351 - if (parent::beforeSave($insert)) {  
352 - var_dump('THERE'); die();  
353 - return true;  
354 - } else {  
355 - var_dump('THERE parent false'); die();  
356 - return false;  
357 - }  
358 - }  
359 -  
360 public function afterSave($insert, $changedAttributes) 357 public function afterSave($insert, $changedAttributes)
361 { 358 {
362 parent::afterSave($insert, $changedAttributes); 359 parent::afterSave($insert, $changedAttributes);