From 99f3201f2466fd1efa3eb48890d049d88fbe5fe0 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 6 Dec 2016 12:41:15 +0200 Subject: [PATCH] remarketing --- console/controllers/FeedController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/console/controllers/FeedController.php b/console/controllers/FeedController.php index 9658679..2f470df 100644 --- a/console/controllers/FeedController.php +++ b/console/controllers/FeedController.php @@ -12,6 +12,7 @@ use yii\console\Controller; use Yii; use yii\helpers\Url; use common\modules\product\models\Product; +use common\modules\product\models\ProductVariant; use common\modules\product\models\Category; use frontend\models\ProductFrontendSearch; @@ -28,13 +29,16 @@ class FeedController extends Controller private $count = 1; public function getProducts() { - return Product::find()->limit(100)->all(); + return Product::find() + ->limit(1000) + ->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id = '. Product::tableName() .'.product_id') + ->where([ProductVariant::tableName().'.staus' => '1']) + ->all(); } public function createRow( $product, &$content ){ if ($this->checkId($product->product_id)) { - print $product->product_id."\r\n"; - //print $this->count++ . "\n"; + print $this->count++ . "\r\n"; $content[] = [ $product->product_id, $product->category->category_id, -- libgit2 0.21.4