Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Google XML Sitemap SEO


1179 replies to this topic

#1 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 02 March 2009, 18:41

This isn't a new contribution and I don't claim the code in it. This is an update to the excellent work Chemo did on the Google XML Sitemap Feed located here: http://addons.oscommerce.com/info/3233 - version 1.3. It was added as a new contribution do prevent the corruption that exists in so many contributions lately.

This version includes the following changes:
- Manufacturers site map
- Specials site map
- Human readable output

The feeds automatically adjust to match the urls if Ultimate SEO is installed, thus preventing some blocked url's by the search engines.

If you have version 1.3 of the above contribution installed, you can just upload all of the files to update to this version. Be sure to run the sitemap afterwards though.

Jack

#2 XenoPhage

  • Community Member
  • 19 posts
  • Real Name:Jason Frisvold

Posted 02 March 2009, 22:55

View PostJack_mcs, on Mar 2 2009, 01:41 PM, said:

The feeds automatically adjust to match the urls if Ultimate SEO is installed, thus preventing some blocked url's by the search engines.

This is exactly what I'm looking for, thanks! I have run into a problem, though. I have Ultimate SEO URLs 2.6 installed and I'm receiving a few errors when I run the sitemap generator. The errors appear to be coming from the Ultimate SEO contrib though. So is Google sitemap compatible with Ultimate 2.6 ? The errors are below:

Notice: Undefined variable: connection in /Users/XenoPhage/Sites/osc/includes/classes/seo.class.php on line 841
Notice: Undefined offset: -1 in /Users/XenoPhage/Sites/osc/includes/classes/seo.class.php on line 1156
Notice: Undefined variable: _sid in /Users/XenoPhage/Sites/osc/includes/classes/seo.class.php on line 799

Thanks!
XenoPhage

#3 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 02 March 2009, 23:22

This contribution should work with with all of the versions of Ultimate SEO but there are so many that I can't say for sure. It will work with the last version I uploaded though. As long as you have a version past that, all you need to do to update it is to upload the included files.

Jack

#4 Benjjj6

  • Community Member
  • 470 posts
  • Real Name:Ben
  • Gender:Male

Posted 03 March 2009, 17:01

On mysite.com/googlesitemap/index.php I get the following message:

Warning:  fopen(/sitemapproducts.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 300

ERROR: Google Product Sitemap Generation FAILED!



Warning:  fopen(/sitemapcategories.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 300

ERROR: Google Category Sitemap Generation FAILED!



Warning:  fopen(/sitemapmanufacturers.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 300

ERROR: Google Manufacturer Sitemap Generation FAILED!



Warning:  fopen(/sitemapspecials.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 300

ERROR: Google Specials Sitemap Generation FAILED!



Warning:  Invalid argument supplied for foreach() in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 384



Warning:  fopen(/sitemapindex.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 300

ERROR: Google Sitemap Index Generation FAILED!

Array
(
	[QUERY] => Array
		(
			[PRODUCTS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 881
				)

			[CATEOGRY] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 67
				)

			[MANUFACTURERS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 203
				)

			[SPECIALS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 6
				)

		)

	[SAVE_FILE_XML] => Array
		(
			[0] => Array
				(
					[file] => /sitemapproducts.xml
					[status] => failure
					[file_exists] => false
				)

			[1] => Array
				(
					[file] => /sitemapcategories.xml
					[status] => failure
					[file_exists] => false
				)

			[2] => Array
				(
					[file] => /sitemapmanufacturers.xml
					[status] => failure
					[file_exists] => false
				)

			[3] => Array
				(
					[file] => /sitemapspecials.xml
					[status] => failure
					[file_exists] => false
				)

			[4] => Array
				(
					[file] => /sitemapindex.xml
					[status] => failure
					[file_exists] => false
				)

		)

)


#5 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 03 March 2009, 18:34

Be sure the permissions of the sitemap files are set the same as the images directory.

Jack

#6 Benjjj6

  • Community Member
  • 470 posts
  • Real Name:Ben
  • Gender:Male

Posted 03 March 2009, 18:50

Hi Jack

Yes, they are all set to 777.

#7 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 03 March 2009, 19:24

It looks like your configure file settings are not being loaded. Please try this: In the googlesitemap/sitemap_class.php file, find this line around line 299
$filename .= '.xml';
and add this after it
		 echo 'Opening   '.$filename. '<br>FS_CAT	'.DIR_FS_CATALOG. '<br>Server	' . HTTP_SERVER . '<br>Save Path '. $this->savepath . '<br>WS_CAT	'. DIR_WS_HTTP_CATALOG.' <br>';
Upload the changed file and run the code by going to http://yourdomain.com/googlesitemap/index.php. Post the output here.

Jack

#8 Benjjj6

  • Community Member
  • 470 posts
  • Real Name:Ben
  • Gender:Male

Posted 03 March 2009, 19:48

Here's the output:


Opening   /sitemapproducts.xml
FS_CAT	/home/topgoth/public_html/
Server	http://www.topgoth.co.uk
Save Path /
WS_CAT	/ 


Warning:  fopen(/sitemapproducts.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 303

ERROR: Google Product Sitemap Generation FAILED!

Opening   /sitemapcategories.xml
FS_CAT	/home/topgoth/public_html/
Server	http://www.topgoth.co.uk
Save Path /
WS_CAT	/ 


Warning:  fopen(/sitemapcategories.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 303

ERROR: Google Category Sitemap Generation FAILED!

Opening   /sitemapmanufacturers.xml
FS_CAT	/home/topgoth/public_html/
Server	http://www.topgoth.co.uk
Save Path /
WS_CAT	/ 


Warning:  fopen(/sitemapmanufacturers.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 303

ERROR: Google Manufacturer Sitemap Generation FAILED!

Opening   /sitemapspecials.xml
FS_CAT	/home/topgoth/public_html/
Server	http://www.topgoth.co.uk
Save Path /
WS_CAT	/ 


Warning:  fopen(/sitemapspecials.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 303

ERROR: Google Specials Sitemap Generation FAILED!



Warning:  Invalid argument supplied for foreach() in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 387

Opening   /sitemapindex.xml
FS_CAT	/home/topgoth/public_html/
Server	http://www.topgoth.co.uk
Save Path /
WS_CAT	/ 


Warning:  fopen(/sitemapindex.xml) [function.fopen]: failed to open stream: Permission denied in /home/topgoth/public_html/googlesitemap/sitemap.class.php on line 303

ERROR: Google Sitemap Index Generation FAILED!

Array
(
	[QUERY] => Array
		(
			[PRODUCTS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 881
				)

			[CATEOGRY] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 67
				)

			[MANUFACTURERS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 203
				)

			[SPECIALS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 6
				)

		)

	[SAVE_FILE_XML] => Array
		(
			[0] => Array
				(
					[file] => /sitemapproducts.xml
					[status] => failure
					[file_exists] => false
				)

			[1] => Array
				(
					[file] => /sitemapcategories.xml
					[status] => failure
					[file_exists] => false
				)

			[2] => Array
				(
					[file] => /sitemapmanufacturers.xml
					[status] => failure
					[file_exists] => false
				)

			[3] => Array
				(
					[file] => /sitemapspecials.xml
					[status] => failure
					[file_exists] => false
				)

			[4] => Array
				(
					[file] => /sitemapindex.xml
					[status] => failure
					[file_exists] => false
				)

		)

)


#9 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 03 March 2009, 23:53

The path is not being picked up for some reason. Give this a try. At around line 266, find this line
		  $this->savepath = DIR_FS_CATALOG . (substr(DIR_FS_CATALOG, 0, -1) !== '/') ? '/' : '';
Below it, paste the following:
		  $this->savepath = DIR_FS_CATALOG . (substr(DIR_FS_CATALOG, 0, -1) !== '/') ? '/' : '';
										  echo 'set '.$this->savepath.'<br>';
Upload and see what happens. If that still fails, remove that change and use this instead
$this->savepath = '/home/topgoth/public_html/';
Please post the results of the first one either so I can get an idea of what the problem is.

Jack

#10 dinera

  • Community Member
  • 5 posts
  • Real Name:dinesh eranga

Posted 04 March 2009, 17:16

This is what i get with

ERROR: Google Product Sitemap Generation FAILED!

ERROR: Google Category Sitemap Generation FAILED!

ERROR: Google Manufacturer Sitemap Generation FAILED!

ERROR: Google Specials Sitemap Generation FAILED!

ERROR: Google Sitemap Index Generation FAILED!

Array
(
	[QUERY] => Array
		(
			[PRODUCTS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 366
				)

			[CATEOGRY] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 58
				)

			[MANUFACTURERS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 11
				)

			[SPECIALS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 1
				)

		)

	[SAVE_FILE_XML] => Array
		(
			[0] => Array
				(
					[file] => /sitemapproducts.xml
					[status] => failure
					[file_exists] => false
				)

			[1] => Array
				(
					[file] => /sitemapcategories.xml
					[status] => failure
					[file_exists] => false
				)

			[2] => Array
				(
					[file] => /sitemapmanufacturers.xml
					[status] => failure
					[file_exists] => false
				)

			[3] => Array
				(
					[file] => /sitemapindex.xml
					[status] => failure
					[file_exists] => false
				)

		)

)


#11 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 04 March 2009, 19:07

Please try the previous tests.

Jack

#12 rrchairman

  • Community Member
  • 7 posts
  • Real Name:Jason Aram

Posted 04 March 2009, 23:05

Hi,

I had the same problem as Benjjj6

What I did was enter the code from your post 7

and change the lines from 263-266 to this:

$this->savepath .= (substr($this->savepath, 0, -1) !== '') ? '' : ''; //append a slash if needed
}
else
$this->savepath = DIR_FS_CATALOG . (substr(DIR_FS_CATALOG, 0, -1) !== '') ? '' : '';


It now works, great contribution

#13 Benjjj6

  • Community Member
  • 470 posts
  • Real Name:Ben
  • Gender:Male

Posted 05 March 2009, 00:06

View PostJack_mcs, on Mar 3 2009, 11:53 PM, said:

The path is not being picked up for some reason. Give this a try. At around line 266, find this line
		  $this->savepath = DIR_FS_CATALOG . (substr(DIR_FS_CATALOG, 0, -1) !== '/') ? '/' : '';
Below it, paste the following:
		  $this->savepath = DIR_FS_CATALOG . (substr(DIR_FS_CATALOG, 0, -1) !== '/') ? '/' : '';
										  echo 'set '.$this->savepath.'<br>';
Upload and see what happens. If that still fails, remove that change and use this instead
$this->savepath = '/home/topgoth/public_html/';
Please post the results of the first one either so I can get an idea of what the problem is.

Jack


Hi Jack,

The first suggestion caused the same error, however the second solution solved the problem. The sitemap is now created successfully! :)

Thank you,

Ben

#14 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 05 March 2009, 00:35

View PostBenjjj6, on Mar 4 2009, 07:06 PM, said:

Hi Jack,

The first suggestion caused the same error, however the second solution solved the problem. The sitemap is now created successfully! :)
I'm glad it is working for you but I don't care for that solution. As long as the path to your shop doesn't change, it will be OK. But if you change servers, the code will break since the path will break. I'll look closer at the code and try to find a better solution. Once found, I'll post it in a new version. Thanks for trying those code changes.

Jack

#15 XenoPhage

  • Community Member
  • 19 posts
  • Real Name:Jason Frisvold

Posted 05 March 2009, 01:51

View PostJack_mcs, on Mar 4 2009, 07:35 PM, said:

I'm glad it is working for you but I don't care for that solution. As long as the path to your shop doesn't change, it will be OK. But if you change servers, the code will break since the path will break. I'll look closer at the code and try to find a better solution. Once found, I'll post it in a new version. Thanks for trying those code changes.

Jack

I haven't looked deep into this, but what path are you after? Why isn't DIR_FS_CATALOG sufficient? That resolves to the proper location for me ... ?
XenoPhage

#16 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 05 March 2009, 02:33

That's the correct path for some servers but others return the googlesitemap directory in the path and that has to be stripped out. I think it might be this line around 299
if ($pos = strpos(DIR_FS_CATALOG, "googlesitemap") !== FALSE)
If anyone who is having the problem wants to try, please change that line to
if (($pos = strpos(DIR_FS_CATALOG, "googlesitemap")) !== FALSE)

Jack

#17 uniquexme

  • Community Member
  • 79 posts
  • Real Name:Desmond Tay

Posted 06 March 2009, 01:36

jack, after applying ur amendments, my problem is halfway fixed. just realize that there is an error for Special sitemap. pls assist.

Opening   /home/content/u/n/i/uniquexme/htmlsitemapproducts.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/htmlsitemapproducts.xml
Generated Google Product Sitemap Successfully

Opening   /home/content/u/n/i/uniquexme/htmlsitemapcategories.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/htmlsitemapcategories.xml
Generated Google Category Sitemap Successfully

Opening   /home/content/u/n/i/uniquexme/htmlsitemapmanufacturers.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/htmlsitemapmanufacturers.xml
Generated Google Manufacturer Sitemap Successfully

ERROR: Google Specials Sitemap Generation FAILED!

Opening   /home/content/u/n/i/uniquexme/htmlsitemapindex.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/htmlsitemapindex.xml
Generated Google Sitemap Index Successfully

Array
(
	[QUERY] => Array
		(
			[PRODUCTS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 216
				)

			[CATEOGRY] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 24
				)

			[MANUFACTURERS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 23
				)

			[SPECIALS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 0
				)

		)

	[SAVE_FILE_XML] => Array
		(
			[0] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/htmlsitemapproducts.xml
					[status] => success
					[file_exists] => true
				)

			[1] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/htmlsitemapcategories.xml
					[status] => success
					[file_exists] => true
				)

			[2] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/htmlsitemapmanufacturers.xml
					[status] => success
					[file_exists] => true
				)

			[3] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/htmlsitemapindex.xml
					[status] => success
					[file_exists] => true
				)

		)

)

Edited by uniquexme, 06 March 2009, 01:47.


#18 uniquexme

  • Community Member
  • 79 posts
  • Real Name:Desmond Tay

Posted 06 March 2009, 01:45

er.. Jack, referring back to the install guide, i didn't see this in the last line

Quote

"If you have not already submitted the sitemap index to Google click the link below"

and when i tried to view the XML files by keying in www.hobby-asia.com/sitemapindex.xml it shows this :

Quote

XML Parsing Error: no element found
Location: http://www.hobby-asia.com/sitemapindex.xml
Line Number 1, Column 1:


#19 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 06 March 2009, 02:59

View Postuniquexme, on Mar 5 2009, 08:36 PM, said:

jack, after applying ur amendments, my problem is halfway fixed. just realize that there is an error for Special sitemap. pls assist.

Opening /home/content/u/n/i/uniquexme/htmlsitemapproducts.xml
Without knowning what changes you made to the file, I can't say where the problem is. But the problem now is that the sitemaps are not being created. The above line should read
/home/content/u/n/i/uniquexme/html/sitemapproducts.xml
Notice the missing /. So none of your sitemap files are being saved since the path is invalid. Please post the section of the file you changed (near the top) so I can see what the problem is.

Jack

#20 uniquexme

  • Community Member
  • 79 posts
  • Real Name:Desmond Tay

Posted 06 March 2009, 03:09

jack, i follow the changes from your post here post #7 & 9. and the only changes i did myself was to the #9
from

$this->savepath = '/home/topgoth/public_html/';

to

$this->savepath = '/home/content/u/n/i/uniquexme/html/';

well, just now i forgot to include the "/" after html. now that i correct it, it still shows the same error.

Opening   /home/content/u/n/i/uniquexme/html/sitemapproducts.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html/
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/html/sitemapproducts.xml
Generated Google Product Sitemap Successfully

Opening   /home/content/u/n/i/uniquexme/html/sitemapcategories.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html/
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/html/sitemapcategories.xml
Generated Google Category Sitemap Successfully

Opening   /home/content/u/n/i/uniquexme/html/sitemapmanufacturers.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html/
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/html/sitemapmanufacturers.xml
Generated Google Manufacturer Sitemap Successfully

ERROR: Google Specials Sitemap Generation FAILED!

Opening   /home/content/u/n/i/uniquexme/html/sitemapindex.xml
FS_CAT	/home/content/u/n/i/uniquexme/html/
Server	http://www.hobby-asia.com
Save Path /home/content/u/n/i/uniquexme/html/
WS_CAT	/ 
Write /home/content/u/n/i/uniquexme/html/sitemapindex.xml
Generated Google Sitemap Index Successfully

Array
(
	[QUERY] => Array
		(
			[PRODUCTS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 216
				)

			[CATEOGRY] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 24
				)

			[MANUFACTURERS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 23
				)

			[SPECIALS] => Array
				(
					[STATUS] => success
					[NUM_ROWS] => 0
				)

		)

	[SAVE_FILE_XML] => Array
		(
			[0] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/html/sitemapproducts.xml
					[status] => success
					[file_exists] => true
				)

			[1] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/html/sitemapcategories.xml
					[status] => success
					[file_exists] => true
				)

			[2] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/html/sitemapmanufacturers.xml
					[status] => success
					[file_exists] => true
				)

			[3] => Array
				(
					[file] => /home/content/u/n/i/uniquexme/html/sitemapindex.xml
					[status] => success
					[file_exists] => true
				)

		)

)