Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

[CONTRIBUTION] Google XML Sitemap Feed - by Chemo


749 replies to this topic

#1 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:02

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

#2 kitchenniche

  • Community Member
  • 431 posts
  • Real Name:Sandra
  • Location:Kelowna, Beautiful British Columbia, Canada

Posted 05 June 2005, 06:07

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
HIM - Dark Light - Out on 26/09/05

#3 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:11

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

#4 theman

  • Community Member
  • 163 posts
  • Real Name:AL S

Posted 05 June 2005, 06:14

hi chemo,
tried installing this contrib and got the following error

Quote

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


#5 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:18

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

#6 Wendy James

  • Community Member
  • 4,131 posts
  • Real Name:Wendy James
  • Gender:Female
  • Location:Alabama USA

Posted 05 June 2005, 06:19

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, 05 June 2005, 06:20.

Wendy James

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

#7 theman

  • Community Member
  • 163 posts
  • Real Name:AL S

Posted 05 June 2005, 06:23

Chemo, on Jun 4 2005, 11:18 PM, said:

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

<{POST_SNAPBACK}>

alright did that

now get this
ERROR: Google Product Sitemap Generation FAILED! ERROR: Google Category Sitemap Generation FAILED! ERROR: Google Sitemap Index Generation FAILED!


#8 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:24

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

#9 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:26

theman, on Jun 5 2005, 02:23 AM, said:

alright did that

now get this
ERROR: Google Product Sitemap Generation FAILED! ERROR: Google Category Sitemap Generation FAILED! ERROR: Google Sitemap Index Generation FAILED!

<{POST_SNAPBACK}>

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

Bobby

#10 theman

  • Community Member
  • 163 posts
  • Real Name:AL S

Posted 05 June 2005, 06:26

Chemo, on Jun 4 2005, 11:26 PM, said:

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

Bobby

<{POST_SNAPBACK}>

yup did it in my root

#11 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:28

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

#12 theman

  • Community Member
  • 163 posts
  • Real Name:AL S

Posted 05 June 2005, 06:29

Chemo, on Jun 4 2005, 11:28 PM, said:

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

<{POST_SNAPBACK}>


store is in domain.com/catalog/
dummyfiles are domain.com/

#13 Wendy James

  • Community Member
  • 4,131 posts
  • Real Name:Wendy James
  • Gender:Female
  • Location:Alabama USA

Posted 05 June 2005, 06:29

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, 05 June 2005, 06:30.

Wendy James

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

#14 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:31

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

#15 Tomcat

  • Community Member
  • 192 posts
  • Real Name:-
  • Gender:Male
  • Location:Tuscany - Italy

Posted 05 June 2005, 06:32

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
Outside links in signatures are not allowed!

#16 theman

  • Community Member
  • 163 posts
  • Real Name:AL S

Posted 05 June 2005, 06:34

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

Chemo, on Jun 4 2005, 11:24 PM, said:

This is the code on line 83:
	function ConnectDB(){
  $this->link_id = mysql_connect($this->$host, $this->user, $this->pass);
	} # end function

<{POST_SNAPBACK}>


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, 05 June 2005, 06:35.


#17 theman

  • Community Member
  • 163 posts
  • Real Name:AL S

Posted 05 June 2005, 06:36

Chemo, on Jun 4 2005, 11:31 PM, said:

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

<{POST_SNAPBACK}>

same error once again

#18 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:36

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

Good catch!

Bobby

#19 theman

  • Community Member
  • 163 posts
  • Real Name:AL S

Posted 05 June 2005, 06:38

Chemo, on Jun 4 2005, 11:36 PM, said:

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

Good catch!

Bobby

<{POST_SNAPBACK}>

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, 05 June 2005, 06:39.


#20 Chemo

  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 05 June 2005, 06:46

...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...