Jump to content
Sign in to follow this  
grumb1er

Лишние строки в Google_Sitemap

Recommended Posts

Генерирую sitemap:

http://www.z-bags.ru.../google_sitemap

Хочется убрать оттуда строки типа: http://www.z-bags.ru...ufacturer_id=17. По этим ссылкам товары группируются по категориям.

Что подкрутить чтобы они не выводились?

Версия cms ocstore_v1.5.4.1

Поиском искал. Наткнулся на это: http://opencartforum...__google%20base. Не помогает, вообще перестает карта сайта генерироваться.

Вот мой файл google_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="http://www.sitemaps.org/schemas/sitemap/0.9">';
  $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>1.0</priority>';
   $output .= '</url>';
  }
  $this->load->model('catalog/category');
  $output .= $this->getCategories(0);
  $this->load->model('catalog/manufacturer');
  $manufacturers = $this->model_catalog_manufacturer->getManufacturers();
  foreach ($manufacturers as $manufacturer) {
   $output .= '<url>';
   $output .= '<loc>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']))) . '</loc>';
   $output .= '<changefreq>weekly</changefreq>';
   $output .= '<priority>0.7</priority>';
   $output .= '</url>';
  }
  $this->load->model('catalog/information');
  $informations = $this->model_catalog_information->getInformations();
  foreach ($informations as $information) {
   $output .= '<url>';
   $output .= '<loc>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('information/information', 'information_id=' . $information['information_id']))) . '</loc>';
   $output .= '<changefreq>weekly</changefreq>';
   $output .= '<priority>0.5</priority>';
   $output .= '</url>';
  }
  $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.7</priority>';
  $output .= '</url>';
  $output .= $this->getCategories($result['category_id'], $new_path);
 }
 return $output;
}
}
?>

Share this post


Link to post
Share on other sites
Guest brk

Чего вы хотите добиться не совсем понятно.

Вы про SEO или про что вообще?

Если про SEO, то robots.txt решает

Share this post


Link to post
Share on other sites

Я про то что не хочу чтобы в файле Sitemap генерировались лишние адреса с не ЧПУ.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.