Opencart tabanlı bir sitemizde silnmiş olan ürünler hala sitemapta görünmekte.
Seo Url kullan açık
wm toolsta sürekli 404 almaya başladım eski sayfalar diye robots.txt den engelledim yeni map yolladığımda farketim. ürünler 0 stok yada durum kapalı değiller tamemen silinmişler.
birçok siteye baktım ancak sonuç alamadım.
Çözüm önerisi olan var mı acaba ?
Sitemap.php aşağıdadır.
class ControllerFeedGoogleSitemap extends Controller {
public function index() {
if ($this->config->get('google_sitemap_status')) {
$output = '';
$output .= '';
$this->load->model('catalog/product');
$products = $this->model_catalog_product->getProducts();
foreach ($products as $product) {
$output .= '';
$output .= '' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . ' ';
$output .= 'weekly ';
$output .= '1.0 ';
$output .= ' ';
}
$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 .= '';
$output .= '' . $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']) . ' ';
$output .= 'weekly ';
$output .= '0.7 ';
$output .= ' ';
$products = $this->model_catalog_product->getProducts(array('filter_manufacturer_id' => $manufacturer['manufacturer_id']));
foreach ($products as $product) {
$output .= '';
$output .= '' . $this->url->link('product/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']) . ' ';
$output .= 'weekly ';
$output .= '1.0 ';
$output .= ' ';
}
}
$this->load->model('catalog/information');
$informations = $this->model_catalog_information->getInformations();
foreach ($informations as $information) {
$output .= '';
$output .= '' . $this->url->link('information/information', 'information_id=' . $information['information_id']) . ' ';
$output .= 'weekly ';
$output .= '0.5 ';
$output .= ' ';
}
$output .= ' ';
$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 .= '';
$output .= '' . $this->url->link('product/category', 'path=' . $new_path) . ' ';
$output .= 'weekly ';
$output .= '0.7 ';
$output .= ' ';
$products = $this->model_catalog_product->getProducts(array('filter_category_id' => $result['category_id']));
foreach ($products as $product) {
$output .= '';
$output .= '' . $this->url->link('product/product', 'path=' . $new_path . '&product_id=' . $product['product_id']) . ' ';
$output .= 'weekly ';
$output .= '1.0 ';
$output .= ' ';
}
$output .= $this->getCategories($result['category_id'], $new_path);
}
return $output;
}
}
?>