Приветствую,
имею проблему с генерацией файла сайтмап.
Скрин http://joxi.ru/V2Vpl5kc3Jbjrv
Суть проблемы заключается в том что в sitemap появляется лишний пробел.
Восстанавливал исходные файлы, не помогло. Пытался найти в интернете какое-то решение - увы, все не то.
Пытался даже ставить другие модификации сайтмапа,(Google Sitemap Fast и [_FAST_] Sitemap) та же проблема.
https://flame.az/index.php?route=feed/google_sitemap
Буду рад если подскажите в каком направлении искать.
Сам файл sitemap
<?php
class ControllerFeedGoogleSitemap extends Controller {
public function index() {
if ($this->config->get('google_sitemap_status')) {
$output = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">';
$output .= '<url>';
$output .= '<loc>' . HTTP_SERVER . '</loc>';
$output .= '<changefreq>daily</changefreq>';
$output .= '<priority>1.0</priority>';
$output .= '</url>';
$this->load->model('catalog/product');
$products = $this->model_catalog_product->getProducts();
foreach ($products as $product) {
$output .= '<url>';
$output .= '<loc>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</loc>';
$output .= '<lastmod>' . substr(max($product['date_added'], $product['date_modified']), 0, 10) . '</lastmod>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>0.9</priority>';
$output .= '</url>';
}
$this->load->model('catalog/category');
$output .= $this->getCategories(0);
$this->load->model('catalog/manufacturer');
$manufacturers = $this->model_catalog_manufacturer->getManufacturers();
$this->load->model('catalog/information');
$informations = $this->model_catalog_information->getInformations();
$output .= '</urlset>';
$this->response->addHeader('Content-Type: application/xml');
$this->response->setOutput($output);
}
}
protected function getCategories($parent_id, $current_path = '') {
$output = '';
$results = $this->model_catalog_category->getCategories($parent_id);
foreach ($results as $result) {
if (!$current_path) {
$new_path = $result['category_id'];
} else {
$new_path = $current_path . '_' . $result['category_id'];
}
$output .= '<url>';
$output .= '<loc>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/category', 'path=' . $new_path))) . '</loc>';
$output .= '<lastmod>' . substr(max($result['date_added'], $result['date_modified']), 0, 10) . '</lastmod>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>0.8</priority>';
$output .= '</url>';
$output .= $this->getCategories($result['category_id'], $new_path);
}
return $output;
}
}
?>