Commit 1d293a4126e26736e264864ff086cdedb1c9735c

Authored by Timur Kastemirov
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 25 return Product::find()
26 26 ->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id = '. Product::tableName() .'.product_id')
27 27 ->where(['and', ProductVariant::tableName().'.status = 0', ProductVariant::tableName().'.stock > 0'])
  28 + ->with('brand')
28 29 ->all();
29 30 }
30   -
  31 +
  32 + /**
  33 + * @param Product $product
  34 + * @param $content
  35 + */
  36 +
31 37 public function createRow( $product, &$content ){
32 38 if ($this->checkId($product->product_id)) {
33 39 print $this->count++ . "\r\n";
... ... @@ -37,7 +43,7 @@ class FeedController extends Controller
37 43 $product->variant->product_variant_id,
38 44 $product->category->category_id,
39 45 $product->category->name,
40   - $product->name,
  46 + $product->brand->name,
41 47 $product->price.' UAH',
42 48 Yii::$app->urlManager->baseUrl.$image,
43 49 $url,
... ...