Commit 7a131af6f084c4957a144ac237593cff6e31c70c
1 parent
fd068f14
remarketing
Showing
1 changed file
with
3 additions
and
5 deletions
Show diff stats
console/controllers/FeedController.php
| @@ -38,7 +38,7 @@ class FeedController extends Controller | @@ -38,7 +38,7 @@ class FeedController extends Controller | ||
| 38 | $url = Url::to(['catalog/product', 'product' => $product]); | 38 | $url = Url::to(['catalog/product', 'product' => $product]); |
| 39 | if($this->checkUrl($url)){ | 39 | if($this->checkUrl($url)){ |
| 40 | print $this->count++ . "\n"; | 40 | print $this->count++ . "\n"; |
| 41 | - $content .= $url."\r\n"; | 41 | + $content[] = [$url]; |
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| 44 | 44 | ||
| @@ -50,15 +50,13 @@ class FeedController extends Controller | @@ -50,15 +50,13 @@ class FeedController extends Controller | ||
| 50 | 50 | ||
| 51 | $handle = fopen($dirName .'/'. $filename, "w"); | 51 | $handle = fopen($dirName .'/'. $filename, "w"); |
| 52 | 52 | ||
| 53 | - $content = 'ID, ID2, Item Category, Item title, Item description, Price'."\r\n"; | 53 | + $content[] = ['ID', 'ID2', 'Item Category', 'Item title', 'Item description', 'Price']; |
| 54 | 54 | ||
| 55 | foreach ($this->getProducts() as $product) { | 55 | foreach ($this->getProducts() as $product) { |
| 56 | $this->createRow($product, $content); | 56 | $this->createRow($product, $content); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | - $content .= '</urlset>'; | ||
| 60 | - | ||
| 61 | - fwrite($handle, $content); | 59 | + fputcsv($handle, $content); |
| 62 | fclose($handle); | 60 | fclose($handle); |
| 63 | 61 | ||
| 64 | print $dirName .'/'. $filename; | 62 | print $dirName .'/'. $filename; |