Commit 1d293a4126e26736e264864ff086cdedb1c9735c
1 parent
87e67a96
feed csv
Showing
1 changed file
with
8 additions
and
2 deletions
Show diff stats
console/controllers/FeedController.php
@@ -25,9 +25,15 @@ class FeedController extends Controller | @@ -25,9 +25,15 @@ class FeedController extends Controller | ||
25 | return Product::find() | 25 | return Product::find() |
26 | ->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id = '. Product::tableName() .'.product_id') | 26 | ->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id = '. Product::tableName() .'.product_id') |
27 | ->where(['and', ProductVariant::tableName().'.status = 0', ProductVariant::tableName().'.stock > 0']) | 27 | ->where(['and', ProductVariant::tableName().'.status = 0', ProductVariant::tableName().'.stock > 0']) |
28 | + ->with('brand') | ||
28 | ->all(); | 29 | ->all(); |
29 | } | 30 | } |
30 | - | 31 | + |
32 | + /** | ||
33 | + * @param Product $product | ||
34 | + * @param $content | ||
35 | + */ | ||
36 | + | ||
31 | public function createRow( $product, &$content ){ | 37 | public function createRow( $product, &$content ){ |
32 | if ($this->checkId($product->product_id)) { | 38 | if ($this->checkId($product->product_id)) { |
33 | print $this->count++ . "\r\n"; | 39 | print $this->count++ . "\r\n"; |
@@ -37,7 +43,7 @@ class FeedController extends Controller | @@ -37,7 +43,7 @@ class FeedController extends Controller | ||
37 | $product->variant->product_variant_id, | 43 | $product->variant->product_variant_id, |
38 | $product->category->category_id, | 44 | $product->category->category_id, |
39 | $product->category->name, | 45 | $product->category->name, |
40 | - $product->name, | 46 | + $product->brand->name, |
41 | $product->price.' UAH', | 47 | $product->price.' UAH', |
42 | Yii::$app->urlManager->baseUrl.$image, | 48 | Yii::$app->urlManager->baseUrl.$image, |
43 | $url, | 49 | $url, |