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 | 18 | |
| 19 | 19 | public function process($filename = NULL, $from = 0) |
| 20 | 20 | { |
| 21 | + | |
| 22 | + $limit = 100; | |
| 21 | 23 | if(empty( $filename )) { |
| 22 | 24 | $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; |
| 23 | 25 | $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "w"); |
| ... | ... | @@ -25,14 +27,13 @@ |
| 25 | 27 | $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "a"); |
| 26 | 28 | } |
| 27 | 29 | |
| 28 | - | |
| 29 | 30 | $products = Product::find() |
| 30 | 31 | ->with([ |
| 31 | 32 | 'variantsWithFilters', |
| 32 | 33 | 'brand', |
| 33 | 34 | 'categories', |
| 34 | 35 | 'filters']) |
| 35 | - ->limit(100) | |
| 36 | + ->limit($limit) | |
| 36 | 37 | ->offset($from) |
| 37 | 38 | ->all(); |
| 38 | 39 | $filesize = Product::find() |
| ... | ... | @@ -79,7 +80,7 @@ |
| 79 | 80 | |
| 80 | 81 | fclose($handle); |
| 81 | 82 | |
| 82 | - $from += 100; | |
| 83 | + $from += $limit; | |
| 83 | 84 | $end = false; |
| 84 | 85 | if($from > $filesize) { |
| 85 | 86 | $end = true; | ... | ... |