Commit 5f2a765a69a301ee992596e573f79b8852a73d2b
1 parent
7c3b817e
full commit
Showing
2 changed files
with
25 additions
and
2 deletions
Show diff stats
controllers/ManageController.php
| @@ -308,7 +308,7 @@ | @@ -308,7 +308,7 @@ | ||
| 308 | 308 | ||
| 309 | if (Yii::$app->request->isAjax) { | 309 | if (Yii::$app->request->isAjax) { |
| 310 | Yii::$app->response->format = Response::FORMAT_JSON; | 310 | Yii::$app->response->format = Response::FORMAT_JSON; |
| 311 | - return $model->goProducts($from, 1); | 311 | + return $model->goProducts($from, 10); |
| 312 | } else { | 312 | } else { |
| 313 | throw new \HttpRequestException('Must be AJAX'); | 313 | throw new \HttpRequestException('Must be AJAX'); |
| 314 | } | 314 | } |
models/Import.php
| @@ -5,6 +5,8 @@ | @@ -5,6 +5,8 @@ | ||
| 5 | use artweb\artbox\language\models\Language; | 5 | use artweb\artbox\language\models\Language; |
| 6 | use Yii; | 6 | use Yii; |
| 7 | use yii\base\Model; | 7 | use yii\base\Model; |
| 8 | + use yii\db\pgsql\QueryBuilder; | ||
| 9 | + use yii\db\Query; | ||
| 8 | use yii\helpers\ArrayHelper; | 10 | use yii\helpers\ArrayHelper; |
| 9 | 11 | ||
| 10 | /** | 12 | /** |
| @@ -616,7 +618,20 @@ | @@ -616,7 +618,20 @@ | ||
| 616 | ) ); | 618 | ) ); |
| 617 | 619 | ||
| 618 | $result_items = []; | 620 | $result_items = []; |
| 619 | - | 621 | + |
| 622 | + $connection = Yii::$app->getDb(); | ||
| 623 | + | ||
| 624 | + | ||
| 625 | + | ||
| 626 | + $connection->createCommand()->dropForeignKey('product_option_product_product_id_fk','product_option')->execute(); | ||
| 627 | + $connection->createCommand()->dropForeignKey('product_option_tax_option_tax_option_id_fk','product_option')->execute(); | ||
| 628 | + $connection->createCommand()->dropForeignKey('product_variant_option_product_variant_product_variant_id_fk','product_variant_option')->execute(); | ||
| 629 | + $connection->createCommand()->dropForeignKey('product_variant_option_tax_option_tax_option_id_fk','product_variant_option')->execute(); | ||
| 630 | + $connection->createCommand()->dropPrimaryKey('product_option_pkey','product_option')->execute(); | ||
| 631 | + $connection->createCommand()->dropForeignKey('product_variant_option_pkey','product_variant_option')->execute(); | ||
| 632 | + | ||
| 633 | + | ||
| 634 | + | ||
| 620 | while (( empty( $limit ) || $j++ < $limit ) && ( $data = fgetcsv($handle, 10000, ";") ) !== false) { | 635 | while (( empty( $limit ) || $j++ < $limit ) && ( $data = fgetcsv($handle, 10000, ";") ) !== false) { |
| 621 | try { | 636 | try { |
| 622 | 637 | ||
| @@ -768,6 +783,14 @@ | @@ -768,6 +783,14 @@ | ||
| 768 | } | 783 | } |
| 769 | 784 | ||
| 770 | } | 785 | } |
| 786 | + $connection->createCommand()->addPrimaryKey('product_variant_option_pkey','product_variant_option',['product_variant_id', 'option_id'])->execute(); | ||
| 787 | + $connection->createCommand()->addPrimaryKey('product_option_pkey','product_option',['product_id', 'option_id'])->execute(); | ||
| 788 | + $connection->createCommand()->addForeignKey('product_variant_option_product_variant_product_variant_id_fk','product_variant_option','product_variant_id','product_variant','id')->execute(); | ||
| 789 | + $connection->createCommand()->addForeignKey('product_variant_option_tax_option_tax_option_id_fk','product_variant_option','option_id','tax_option','id')->execute(); | ||
| 790 | + $connection->createCommand()->addForeignKey('product_option_product_product_id_fk','product_option','product_id','product','id','CASCADE','CASCADE' )->execute(); | ||
| 791 | + $connection->createCommand()->addForeignKey('product_option_tax_option_tax_option_id_fk','product_option','option_id', 'tax_option', 'id','CASCADE','CASCADE' )->execute(); | ||
| 792 | + | ||
| 793 | + | ||
| 771 | 794 | ||
| 772 | $result = [ | 795 | $result = [ |
| 773 | 'end' => feof($handle), | 796 | 'end' => feof($handle), |