Commit 99f3201f2466fd1efa3eb48890d049d88fbe5fe0
1 parent
0b1d02d7
remarketing
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
console/controllers/FeedController.php
@@ -12,6 +12,7 @@ use yii\console\Controller; | @@ -12,6 +12,7 @@ use yii\console\Controller; | ||
12 | use Yii; | 12 | use Yii; |
13 | use yii\helpers\Url; | 13 | use yii\helpers\Url; |
14 | use common\modules\product\models\Product; | 14 | use common\modules\product\models\Product; |
15 | +use common\modules\product\models\ProductVariant; | ||
15 | 16 | ||
16 | use common\modules\product\models\Category; | 17 | use common\modules\product\models\Category; |
17 | use frontend\models\ProductFrontendSearch; | 18 | use frontend\models\ProductFrontendSearch; |
@@ -28,13 +29,16 @@ class FeedController extends Controller | @@ -28,13 +29,16 @@ class FeedController extends Controller | ||
28 | private $count = 1; | 29 | private $count = 1; |
29 | 30 | ||
30 | public function getProducts() { | 31 | public function getProducts() { |
31 | - return Product::find()->limit(100)->all(); | 32 | + return Product::find() |
33 | + ->limit(1000) | ||
34 | + ->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id = '. Product::tableName() .'.product_id') | ||
35 | + ->where([ProductVariant::tableName().'.staus' => '1']) | ||
36 | + ->all(); | ||
32 | } | 37 | } |
33 | 38 | ||
34 | public function createRow( $product, &$content ){ | 39 | public function createRow( $product, &$content ){ |
35 | if ($this->checkId($product->product_id)) { | 40 | if ($this->checkId($product->product_id)) { |
36 | - print $product->product_id."\r\n"; | ||
37 | - //print $this->count++ . "\n"; | 41 | + print $this->count++ . "\r\n"; |
38 | $content[] = [ | 42 | $content[] = [ |
39 | $product->product_id, | 43 | $product->product_id, |
40 | $product->category->category_id, | 44 | $product->category->category_id, |