Latest News: (loading..)
Chemo

[CONTRIBUTION] Google XML Sitemap Feed - by Chemo

755 posts in this topic

The experimental Google XML sitemap service was announced on 2 June 2005 and represents a huge development in terms of crawler technology. This contribution is designed to create the sitemap XML feed per the protocol specification delineated by Google.

 

WHAT THIS CONTRIBUTION DOES

This contribution creates a sitemap index file and also 2 additional sitemaps (products and categories). It is designed to be run via CRON (primary and preferred method) and also browser as needed.

 

Once the XML feeds are created a store owner should only submit the sitemap index which points to the product and category sitemaps.

 

WHY SHOULD A STORE INSTALL A GOOGLE XML SITEMAP?

...because Google wants to experiment with the service as a means to improve their search result quality. Any time Google wants to experiment I'm in...

 

NOTES

The code is THOROUGHLY documented so that other developers can jump on and help. I put a huge amount of time with the documentation on this one so hopefully I'll get some help with future development.

 

...besides, having quality code AND quality documentation is just sexy :)

 

DOWNLOAD

Google XML Sitemap Feed - by Chemo

 

Enjoy!

 

Bobby

Share this post


Link to post
Share on other sites

Hi Bobby,

 

This sounds pretty interesting, thanks for posting it in the forums. :thumbsup:

 

Is this Google-Sitemap something to do with the "usual" sitemap? Would i have to replace the sitemap i currently have with the google-sitemap?

 

Thanks,

 

Sandra

Share this post


Link to post
Share on other sites

The Google sitemap is an XML feed that will be used by the Google spider to crawl your site. Read about it here: [RUL=https://www.google.com/webmasters/sitemaps/docs/en/about.html]About the Google XML Sitemap Feed[/url].

 

Also, there is a FAQ located here: Google XML Sitemap FAQ.

 

In a nutshell, it's a Google experiment...the effect can only be positive and will NOT detract from normal spider activity. Per Google, "In most cases, webmasters will benefit from Sitemap submission, and in no case will you be penalized for it".

 

Bobby

Share this post


Link to post
Share on other sites

hi chemo,

tried installing this contrib and got the following error

Fatal error: Call to a member function on a non-object in /*****/htdocs/*****/catalog/googlesitemap/index.php on line 66

Share this post


Link to post
Share on other sites

Open the file and find this line of code on 66:

$cache->get_cache('GLOBAL');

and change it to this:

//$cache->get_cache('GLOBAL');

Save the file and try it again! :)

 

Bobby

Share this post


Link to post
Share on other sites

I ran right away to give this a try and got

 

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.asylum/cinnie/homeandgardengiftsandcollectibles/googlesitemap/sitemap.class.php on line 83

ERROR: Google Product Sitemap Generation FAILED! ERROR: Google Category Sitemap Generation FAILED! Generated Google Sitemap Index Successfully

 

when running the googlesitemap/index.php

Edited by wendyjames

Share this post


Link to post
Share on other sites
Open the file and find this line of code on 66:

$cache->get_cache('GLOBAL');

and change it to this:

//$cache->get_cache('GLOBAL');

Save the file and try it again! :)

 

Bobby

alright did that

 

now get this

ERROR: Google Product Sitemap Generation FAILED! ERROR: Google Category Sitemap Generation FAILED! ERROR: Google Sitemap Index Generation FAILED!

Share this post


Link to post
Share on other sites

This is the code on line 83:

	function ConnectDB(){
 $this->link_id = mysql_connect($this->$host, $this->user, $this->pass);
} # end function

Basically, it's the database connection...so, there is an error with the credentials being provided.

 

This is puzzling as it is passing the same credentials to the class that are defined in the configure.php file. So, if it works on the store it should work for the class as well.

 

The GoogleSitemap class is initialized with this code:

$google = new GoogleSitemap(DB_SERVER, DB_SERVER_USERNAME, DB_DATABASE, DB_SERVER_PASSWORD);

As you can see, it's using the defined constants from configure.php

 

Are there any other errors generated? Maybe the actual problem is a bit higher but that is the script kill point?

 

Bobby

Share this post


Link to post
Share on other sites
alright did that

 

now get this

ERROR: Google Product Sitemap Generation FAILED! ERROR: Google Category Sitemap Generation FAILED! ERROR: Google Sitemap Index Generation FAILED!

Did you upload the dummy XML files and change the permissions to 777 ???

 

Bobby

Share this post


Link to post
Share on other sites

Tell me about your setup...

 

Is your store installed in the root? Like domain.com/ or is it domain.com/directory/?

 

Where did you upload the dummy files?

 

Bobby

Share this post


Link to post
Share on other sites
Tell me about your setup...

 

Is your store installed in the root?  Like domain.com/ or is it domain.com/directory/?

 

Where did you upload the dummy files?

 

Bobby

 

store is in domain.com/catalog/

dummyfiles are domain.com/

Share this post


Link to post
Share on other sites

Not that I can see. I copy and pasted the whole page (error)

Could I enter that information manually or does it have to be grabbed from the configure.php?

 

I don't know a whole bunch about coding, but I looked at the sitemap.class.php and it even made sense to me. lol Not sure why it is happening though, and so you know my site is not having any problems right now. I checked, just to be sure.

 

lol You are very busy so I can wait.. if you want to help one at a time. =)

Edited by wendyjames

Share this post


Link to post
Share on other sites

Dummy files should be in the catalog directory like this:

 

domain.com/catalog/sitemapindex.xml

domain.com/catalog/sitemapproducts.xml

domain.com/catalog/sitemapcategories.xml

 

Move them to the catalog directory, set the permissions as 777, and give it one more try. :)

 

Bobby

Share this post


Link to post
Share on other sites

and I get this error :

Fatal error: Call to undefined function: tep_session_is_registered() in /home/i8carati/public_html/catalog/includes/functions/html_output.php on line 237

 

Dummy files are chmoded to 777 and stored on public_html ( root)

sitemap directory is under mydomain.com/catalog/

 

Any idea ?

 

Thanks

Share this post


Link to post
Share on other sites

wendy this might be the error..but chemo should double check..

 

This is the code on line 83:

	function ConnectDB(){
 $this->link_id = mysql_connect($this->$host, $this->user, $this->pass);
} # end function

 

not sure if im right but looks like there is an errror on line 83 and should read

  $this->link_id = mysql_connect($this->host, $this->user, $this->pass);

 

instead of

$this->link_id = mysql_connect($this->$host, $this->user, $this->pass);

as there is an extra $ in this line

Edited by theman

Share this post


Link to post
Share on other sites
Dummy files should be in the catalog directory like this:

 

domain.com/catalog/sitemapindex.xml

domain.com/catalog/sitemapproducts.xml

domain.com/catalog/sitemapcategories.xml

 

Move them to the catalog directory, set the permissions as 777, and give it one more try. :)

 

Bobby

same error once again

Share this post


Link to post
Share on other sites

omg...you are absolutely correct. I'll upload another version...in the meantime everyone correct that.

 

Good catch!

 

Bobby

Share this post


Link to post
Share on other sites
omg...you are absolutely correct.  I'll upload another version...in the meantime everyone correct that.

 

Good catch!

 

Bobby

alright now that thats fixed i get another error :~

 


Fatal error: Call to undefined function: tep_session_is_registered() in /homepages/9/*********/htdocs/***/catalog/includes/functions/html_output.php on line 207

 

here are my lines 207 - 221

	if (!tep_session_is_registered('customer_id') && ENABLE_PAGE_CACHE == 'true' && class_exists('page_cache')) {
 $link .= $separator . '<osCsid>';
	 $seo_link .= $separator . '<osCsid>';
	 $seo_rewrite_link .= $separator . '<osCsid>';
} elseif (isset($_sid)) {
 $link .= $separator . $_sid;
   $seo_link .= $separator . $_sid;
   $seo_rewrite_link .= $separator . $_sid;
}
  
if ($seo == 'true') {
 return ($seo_rewrite_type == 'Rewrite' ? $seo_rewrite_link : $seo_link);
} else {
 return $link;
}

Edited by theman

Share this post


Link to post
Share on other sites

...OK...try this:

 

Somewhere near the top of googlesitemap/index.php paste this code:

function tep_session_is_registered( $var ){
   return false;
}

If it works for you I'll roll it into the next release immediately...

 

The reason there is that error is because I had to eliminate the sessions all together...or it would not run under CRON properly. So, it looks like that is the last piece of the puzzle.

 

I did not experience that problem since it was developed on a dev server with the new SEO URLs.

 

Try it and let me know how it goes...

Share this post


Link to post
Share on other sites

I have exactly the same error now, but it says line 205. lol

 

How do you guys do it? I would never ever have spotted an extra $. Guess that is why I am just a housewife. lol

Share this post


Link to post
Share on other sites

Wendy...I offered a quick bit of code in the previous post. Can you grab it and save it somewhere near the top of googlesitemap/index.php? Let me know if that works for you...

 

Bobby

Share this post


Link to post
Share on other sites

that tepsession error goes away but then i get the

ERROR: Google Product Sitemap Generation FAILED! ERROR: Google Category Sitemap Generation FAILED! ERROR: Google Sitemap Index Generation FAILED!

Share this post


Link to post
Share on other sites

adding

 

function tep_session_is_registered( $var ){

return false;

}

 

worked for me Chemo... atleast I think it did. I get this now

 

 

Generated Google Product Sitemap Successfully Generated Google Category Sitemap Successfully Generated Google Sitemap Index Successfully All files generated successfully. If you have not already submitted the sitemap index to Google click the link below. http://www.google.com/webmasters/sitemaps/...itemapindex.xml

 

oops, except that the link is not clickable and has extra vharacters in it... not sure why it pasted right

 

says

http%3A%2F%2F<snip on request>%2Fsitemapindex.xml

Edited by mattice

Share this post


Link to post
Share on other sites
that tepsession error goes away but then i get the

ERROR: Google Product Sitemap Generation FAILED! ERROR: Google Category Sitemap Generation FAILED! ERROR: Google Sitemap Index Generation FAILED!

Great! That is progress!

 

Now, let's work on those paths for the files. Maybe I didn't make it clear enough in the install file.

 

The dummy files should be uploaded to the CATALOG directory wherever that may be...whether it is in the root or in a directory.

 

Are the dummy files in the store root?

adding

 

function tep_session_is_registered( $var ){

  return false;

}

 

worked for me Chemo... atleast I think it did. I get this now

Generated Google Product Sitemap Successfully Generated Google Category Sitemap Successfully Generated Google Sitemap Index Successfully All files generated successfully. If you have not already submitted the sitemap index to Google click the link below.

Congratulations! It is installed and ready to view! Take a look at the XML files and make sure the data is good...

 

Bobby

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now