Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Ultimate SEO and google sitemap


Guest

Recommended Posts

Hello Bobby,

Great contribution I must say it is working great.

 

As far as google goes I have to convert the catalog original links to your ultimate SEO links in the google sitemap here is the original code:

<?php
header('Content-type: application/xml');
require("includes/configure.php");

require(DIR_WS_INCLUDES . 'database_tables.php');
require(DIR_WS_FUNCTIONS . 'database.php');
function sitemap($parent_id=0,$parent_string=''){
$result = tep_db_query("SELECT categories_id FROM ". TABLE_CATEGORIES." WHERE parent_id='".$parent_id."' ORDER BY `categories_id`");
while ($row=tep_db_fetch_array($result)) {
//		print_r($row);
	echo '<url><loc>http://'.$_SERVER['HTTP_HOST'].'/index.php?cPath='.$parent_string.$row['categories_id'].'</loc><priority>0.5</priority><lastmod>'.date("Y-m-d").'T00:00:00+00:00</lastmod><changefreq>monthly</changefreq></url>'."\n";
	$rsl = tep_db_query("SELECT products_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES." WHERE categories_id='".$row['categories_id']."'");
	while ($rw=tep_db_fetch_array($rsl)) {
		echo '<url><loc>http://'.$_SERVER['HTTP_HOST'].'/product_info.php?cPath='.$parent_string.$row['categories_id'].'&products_id='.$rw['products_id'].'</loc><priority>0.5</priority><lastmod>'.date("Y-m-d").'T00:00:00+00:00</lastmod><changefreq>monthly</changefreq></url>'."\n";
	}
	sitemap($row['categories_id'],$parent_string.$row['categories_id'].'_');
}
}
tep_db_connect() or die('Unable to connect to database server!');
echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 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/09/sitemap.xsd">
<url><loc>http://'.$_SERVER['HTTP_HOST'].'/</loc><priority>0.5</priority><lastmod>2007-02-01T04:27:55+00:00</lastmod><changefreq>monthly</changefreq></url>';
sitemap();
echo '</urlset>';
?>

 

I think will solve all the indexing problems with google

Link to comment
Share on other sites

Hello Bobby,

Great contribution I must say it is working great.

 

As far as google goes I have to convert the catalog original links to your ultimate SEO links in the google sitemap here is the original code:

<?php
header('Content-type: application/xml');
require("includes/configure.php");

require(DIR_WS_INCLUDES . 'database_tables.php');
require(DIR_WS_FUNCTIONS . 'database.php');
function sitemap($parent_id=0,$parent_string=''){
$result = tep_db_query("SELECT categories_id FROM ". TABLE_CATEGORIES." WHERE parent_id='".$parent_id."' ORDER BY `categories_id`");
while ($row=tep_db_fetch_array($result)) {
//		print_r($row);
	echo '<url><loc>http://'.$_SERVER['HTTP_HOST'].'/index.php?cPath='.$parent_string.$row['categories_id'].'</loc><priority>0.5</priority><lastmod>'.date("Y-m-d").'T00:00:00+00:00</lastmod><changefreq>monthly</changefreq></url>'."\n";
	$rsl = tep_db_query("SELECT products_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES." WHERE categories_id='".$row['categories_id']."'");
	while ($rw=tep_db_fetch_array($rsl)) {
		echo '<url><loc>http://'.$_SERVER['HTTP_HOST'].'/product_info.php?cPath='.$parent_string.$row['categories_id'].'&products_id='.$rw['products_id'].'</loc><priority>0.5</priority><lastmod>'.date("Y-m-d").'T00:00:00+00:00</lastmod><changefreq>monthly</changefreq></url>'."\n";
	}
	sitemap($row['categories_id'],$parent_string.$row['categories_id'].'_');
}
}
tep_db_connect() or die('Unable to connect to database server!');
echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 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/09/sitemap.xsd">
<url><loc>http://'.$_SERVER['HTTP_HOST'].'/</loc><priority>0.5</priority><lastmod>2007-02-01T04:27:55+00:00</lastmod><changefreq>monthly</changefreq></url>';
sitemap();
echo '</urlset>';
?>

 

I think will solve all the indexing problems with google

 

Ok I found the Contribution

http://www.oscommerce.com/community/contri...l/search,google

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...