Commit c730ce4beb7aad161fe28a28b6aed79810941553
Merge remote-tracking branch 'origin/master'
Showing
1 changed file
with
4 additions
and
3 deletions
Show diff stats
common/modules/product/models/Export.php
@@ -18,6 +18,8 @@ | @@ -18,6 +18,8 @@ | ||
18 | 18 | ||
19 | public function process($filename = NULL, $from = 0) | 19 | public function process($filename = NULL, $from = 0) |
20 | { | 20 | { |
21 | + | ||
22 | + $limit = 100; | ||
21 | if(empty( $filename )) { | 23 | if(empty( $filename )) { |
22 | $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; | 24 | $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; |
23 | $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "w"); | 25 | $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "w"); |
@@ -25,14 +27,13 @@ | @@ -25,14 +27,13 @@ | ||
25 | $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "a"); | 27 | $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "a"); |
26 | } | 28 | } |
27 | 29 | ||
28 | - | ||
29 | $products = Product::find() | 30 | $products = Product::find() |
30 | ->with([ | 31 | ->with([ |
31 | 'variantsWithFilters', | 32 | 'variantsWithFilters', |
32 | 'brand', | 33 | 'brand', |
33 | 'categories', | 34 | 'categories', |
34 | 'filters']) | 35 | 'filters']) |
35 | - ->limit(100) | 36 | + ->limit($limit) |
36 | ->offset($from) | 37 | ->offset($from) |
37 | ->all(); | 38 | ->all(); |
38 | $filesize = Product::find() | 39 | $filesize = Product::find() |
@@ -79,7 +80,7 @@ | @@ -79,7 +80,7 @@ | ||
79 | 80 | ||
80 | fclose($handle); | 81 | fclose($handle); |
81 | 82 | ||
82 | - $from += 100; | 83 | + $from += $limit; |
83 | $end = false; | 84 | $end = false; |
84 | if($from > $filesize) { | 85 | if($from > $filesize) { |
85 | $end = true; | 86 | $end = true; |