Na początek dobrze jest dodać witrynę do Google :
https://www.google.com/webmasters/tools/home?hl=pl
Tutaj znajduje się skrypt : http://forum.opencart.com/viewtopic.php?f=23&t=7129
Jednak są w nim dwa błędy:
1. opisany już w tamtym temacie : http://forum.opencart.com/viewtopic.php?p=56446#p56446
2. w jednym miejscu jest : "manufacturer _id" a powinno być "manufacturer_id" (bez spacji przed "_id")
3. Ze względu na to, iż w tym skrypciku ciągle się coś zmienia więc na dzień dzisiejszy trzeba koniecznie dopisać jeszcze :
- Kod: Zaznacz cały
//HTTP
define('HTTP_SERVER', 'http://TWOJA_DOMENA/');
define('HTTP_CATALOG', 'http://TWOJA_DOMENA/');
define('HTTP_IMAGE', 'http://TWOJA_DOMENA/image/');
i po wszystkich poprawkach skrypt powinien wyglądać tak :
- Kod: Zaznacz cały
<?php
//HTTP
define('HTTP_SERVER', 'http://TWOJA_DOMENA/');
define('HTTP_CATALOG', 'http://TWOJA_DOMENA/');
define('HTTP_IMAGE', 'http://TWOJA_DOMENA/image/');
// Config
require('config.php');
// Startup
require_once(DIR_SYSTEM . 'startup.php');
// Database
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
// Base URL
if (@$_SERVER['HTTPS'] != 'on') {
$catalog_url = HTTP_SERVER;
$image_url = HTTP_IMAGE;
} else {
$catalog_url = HTTPS_SERVER;
$image_url = HTTPS_IMAGE;
}
//Output XML
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
//Add the Home Page
echo '<url>' . "\n";
echo '<loc>' . $catalog_url . '</loc>' . "\n";
echo '<changefreq>weekly</changefreq>' . "\n";
echo '<priority>1.0</priority>' . "\n";
echo '</url>' . "\n";
// Settings
$query = $db->query("SELECT value FROM " . DB_PREFIX . "setting WHERE " . DB_PREFIX . "setting.key = 'config_seo_url' LIMIT 1");
if ($query->row['value']) {
// Get alias for information
$query = $db->query("SELECT query, keyword FROM " . DB_PREFIX . "url_alias WHERE query like 'information_id=%'");
foreach ($query->rows as $s_information_alias) {
$information_key = substr($s_information_alias['query'], strrpos($s_information_alias['query'], "=") + 1);
$information_alias[$information_key] = $s_information_alias['keyword'];
}
// Get alias for manufacturer
$query = $db->query("SELECT query, keyword FROM " . DB_PREFIX . "url_alias WHERE query like 'manufacturer_id=%'");
foreach ($query->rows as $s_manufacturer_alias) {
$manufacturer_key = substr($s_manufacturer_alias['query'], strrpos($s_manufacturer_alias['query'], "=") + 1);
$manufacturer_alias[$manufacturer_key] = $s_manufacturer_alias['keyword'];
}
// Get alias for category
$query = $db->query("SELECT query, keyword FROM " . DB_PREFIX . "url_alias WHERE query like 'category_id=%'");
foreach ($query->rows as $s_category_alias) {
$category_key = substr($s_category_alias['query'], strrpos($s_category_alias['query'], "=") + 1);
$category_alias[$category_key] = $s_category_alias['keyword'];
}
// Get alias for product
$query = $db->query("SELECT query, keyword FROM " . DB_PREFIX . "url_alias WHERE query like 'product_id=%'");
foreach ($query->rows as $s_prod_alias) {
$prod_key = substr($s_prod_alias['query'], strrpos($s_prod_alias['query'], "=") + 1);
$prod_alias[$prod_key] = $s_prod_alias['keyword'];
}
// Information
$query = $db->query("SELECT information_id FROM " . DB_PREFIX . "information");
foreach ($query->rows as $information) {
echo '<url>' . "\n";
if (array_key_exists($information['information_id'], $information_alias))
echo '<loc>' . $catalog_url . $information_alias[$information['information_id']] . '</loc>' . "\n";
else
echo '<loc>' . $catalog_url .'index.php?route=information/information&information_id='. $information['information_id'] . '</loc>' . "\n";
echo '<changefreq>monthly</changefreq>' . "\n";
echo '<priority>0.8</priority>' . "\n";
echo '</url>' . "\n";
}
// Manufacturer
$query = $db->query("SELECT manufacturer_id FROM " . DB_PREFIX . "manufacturer");
foreach ($query->rows as $manufacturer) {
echo '<url>' . "\n";
if (array_key_exists($manufacturer['manufacturer_id'], $manufacturer_alias))
echo '<loc>' . $catalog_url . $manufacturer_alias[$manufacturer['manufacturer_id']] . '</loc>' . "\n";
else
echo '<loc>' . $catalog_url .'index.php?route=product/manufacturer&manufacturer_id='. $manufacturer['manufacturer_id'] . '</loc>' . "\n";
echo '<changefreq>weekly</changefreq>' . "\n";
echo '<priority>0.4</priority>' . "\n";
echo '</url>' . "\n";
}
// Category
$query = $db->query("SELECT category_id, UNIX_TIMESTAMP(date_modified) as date_modified FROM " . DB_PREFIX . "category");
foreach ($query->rows as $category) {
echo '<url>' . "\n";
if (array_key_exists($category['category_id'], $category_alias))
echo '<loc>' . $catalog_url . $category_alias[$category['category_id']] . '</loc>' . "\n";
else
echo '<loc>' . $catalog_url .'index.php?route=product/category&path='. $category['category_id'] . '</loc>' . "\n";
echo '<lastmod>'.gmdate(DATE_ATOM,$category['date_modified']).'</lastmod>' . "\n";
echo '<changefreq>weekly</changefreq>' . "\n";
echo '<priority>0.8</priority>' . "\n";
echo '</url>' . "\n";
}
// Product
$query = $db->query("SELECT product_id, UNIX_TIMESTAMP(date_modified) as date_modified FROM " . DB_PREFIX . "product");
foreach ($query->rows as $product) {
echo '<url>' . "\n";
if (array_key_exists($product['product_id'], $prod_alias))
echo '<loc>' . $catalog_url . $prod_alias[$product['product_id']] . '</loc>' . "\n";
else
echo '<loc>' . $catalog_url .'product/product&product_id='. $product['product_id'] . '</loc>' . "\n";
echo '<lastmod>'.gmdate(DATE_ATOM,$product['date_modified']).'</lastmod>' . "\n";
echo '<changefreq>monthly</changefreq>' . "\n";
echo '<priority>0.5</priority>' . "\n";
echo '</url>' . "\n";
}
}
else {
// Information
$query = $db->query("SELECT information_id FROM " . DB_PREFIX . "information");
foreach ($query->rows as $information) {
echo '<url>' . "\n";
echo '<loc>' . $catalog_url .'index.php?route=information/information&information_id='. $information['information_id'] . '</loc>' . "\n";
echo '<changefreq>monthly</changefreq>' . "\n";
echo '<priority>0.8</priority>' . "\n";
echo '</url>' . "\n";
}
// Manufacturer
$query = $db->query("SELECT manufacturer_id FROM " . DB_PREFIX . "manufacturer");
foreach ($query->rows as $manufacturer) {
echo '<url>' . "\n";
echo '<loc>' . $catalog_url .'index.php?route=product/manufacturer&manufacturer_id='. $manufacturer['manufacturer_id'] . '</loc>' . "\n";
echo '<changefreq>weekly</changefreq>' . "\n";
echo '<priority>0.4</priority>' . "\n";
echo '</url>' . "\n";
}
// Category
$query = $db->query("SELECT category_id, date_modified FROM " . DB_PREFIX . "category");
foreach ($query->rows as $category) {
echo '<url>' . "\n";
echo '<loc>' . $catalog_url .'index.php?route=product/category&path='. $category['category_id'] . '</loc>' . "\n";
echo '<lastmod>'.gmdate(DATE_ATOM,time($category['date_modified'])).'</lastmod>' . "\n";
echo '<changefreq>weekly</changefreq>' . "\n";
echo '<priority>0.8</priority>' . "\n";
echo '</url>' . "\n";
}
// Product
$query = $db->query("SELECT product_id, UNIX_TIMESTAMP(date_modified) as date_modified FROM " . DB_PREFIX . "product");
foreach ($query->rows as $product) {
echo '<url>' . "\n";
echo '<loc>' . $catalog_url .'index.php?route=product/product&product_id='. $product['product_id'] . '</loc>' . "\n";
echo '<lastmod>'.gmdate(DATE_ATOM,$product['date_modified']).'</lastmod>' . "\n";
echo '<changefreq>monthly</changefreq>' . "\n";
echo '<priority>0.5</priority>' . "\n";
echo '</url>' . "\n";
}
}
echo '</urlset>';
?>
Oczywiście tam gdzie wpisałem "TWOJA_DOMENA" należy wpisać nazwę SWOJEJ domeny i zapisać plik w głównym katalogu witryny jako np. "g_sitemap.php". Wejść na stronę główną sklepu i ... i cały link będzie wyglądał np. "http://TWOJA_DOMENA/g_sitemap.php" i po krótkiej chwili zobaczymy na ekranie mapę strony w formacie XML. To co zobaczysz trzeba skopiować do pliku o nazwie np. : sitemap.xml (też najlepiej do głównego katalogu sklepu) i aby szybciej google "dobrało się" do naszej witryny najlepiej zgłosić mapę pod adresem który podałem u samej góry.
Pozdrawiam