diff --git a/console/controllers/FeedController.php b/console/controllers/FeedController.php index dae5a63..f1972d9 100644 --- a/console/controllers/FeedController.php +++ b/console/controllers/FeedController.php @@ -38,7 +38,7 @@ class FeedController extends Controller $url = Url::to(['catalog/product', 'product' => $product]); if($this->checkUrl($url)){ print $this->count++ . "\n"; - $content .= $url."\r\n"; + $content[] = [$url]; } } @@ -50,15 +50,13 @@ class FeedController extends Controller $handle = fopen($dirName .'/'. $filename, "w"); - $content = 'ID, ID2, Item Category, Item title, Item description, Price'."\r\n"; + $content[] = ['ID', 'ID2', 'Item Category', 'Item title', 'Item description', 'Price']; foreach ($this->getProducts() as $product) { $this->createRow($product, $content); } - $content .= ''; - - fwrite($handle, $content); + fputcsv($handle, $content); fclose($handle); print $dirName .'/'. $filename; -- libgit2 0.21.4