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