Sitemap
Posted: Sat Mar 07, 2009 1:14 am
Why can't I find the sitemap to edit? >:( I am running V.0.7.9
Cheers
Cheers
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Code: Select all
<?php
class ControllerGSitemap extends Controller {
function index() {
$module =& $this->locator->get('module');
$response =& $this->locator->get('response');
$template =& $this->locator->get('template');
$url =& $this->locator->get('url');
$config =& $this->locator->get('config');
$database =& $this->locator->get('database');
$language =& $this->locator->get('language');
$image =& $this->locator->get('image');
//Google Sitemaps addon for karzina!
// 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="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";
if ($config->get('config_url_alias')) {
//Get all URL's in the site!
$sql = "select `alias` from `url_alias`";
$results = $database->getRows($sql);
foreach($results as $result) {
$page = $result['alias'];
//Static Page - Store Home
echo '<url>' . "\n";
echo '<loc>' . $catalog_url . $page . '</loc>' . "\n";
echo '<changefreq>weekly</changefreq>' . "\n";
echo '<priority>0.9</priority>' . "\n";
echo '</url>' . "\n";
}
}
else {
//Get all URL's in the site!
$sql = "select `query` from `url_alias`";
$results = $database->getRows($sql);
foreach($results as $result) {
$page = $result['query'];
//Static Page - Store Home
echo '<url>' . "\n";
echo '<loc>' . $catalog_url . 'index.php?' . $page . '</loc>' . "\n";
echo '<changefreq>weekly</changefreq>' . "\n";
echo '<priority>0.8</priority>' . "\n";
echo '</url>' . "\n";
}
}
echo '</urlset>';
}
}
?>