Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google XML Sitemap SEO


Jack_mcs

Recommended Posts

Providing the sitemaps increases the chances that that will happen more quickly but is not guaranteed. They won't be indexed until google searches them. That might happen the next day or in several weeks - all at once or a few a week. It is just up to them.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 weeks later...

I was planning this for the next version but haven't had time to test it (see note below regarding this). So if you try it, please let me know how it works.

 

In googlesitemap/index.php, find this code

	include_once(DIR_WS_CLASSES . 'language.php');
$lng = new language();
$languages_id = $lng->language['id'];

and replace it with

    if (isset($_GET['language']))
     $languages_id = (int)$_GET['language'];
   else
   {
  include_once(DIR_WS_CLASSES . 'language.php');
  $lng = new language();
  $languages_id = $lng->language['id'];
}

Then to create sitemaps for other languages, use a url like thiswhere 2 is the id of the language you want the maps in.

 

If you have more than one language, you then need to rename the maps to something else, like sitemapcategories_spanish.xml and add that new map to your google account.

 

The above is not a simple thing to do all of the time and I plan on automating it but it is better than nothing. The problem with this is that without some indication the pages are in different languages, google may see them as duplicate pages. I don't know of any way to know for sure though other than to try it.

 

Hi Jack,

 

Thanks (and others) for the excellent contribution.

 

It works too for many languages.

 

I fixed it for myself as follows :

 

for index.php

 

1) // FS start

$languages_id = (int)$_GET['language'];

if ($languages_id == 0) {

exit();

}

//include_once(DIR_WS_CLASSES . 'language.php');

//$lng = new language();

//$languages_id = $lng->language['id'];

// FS stop

 

2) // FS start

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

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

// FS stop

 

for sitemap_class.php

 

1) // FS start

//function GoogleSitemap($host, $user, $db, $pass){

function GoogleSitemap($host, $user, $db, $pass, $lang){

// FS stop

$this->DB = new MySQL_Database($host, $user, $db, $pass);

// FS start

//$this->filename = "sitemap";

$this->filename = "sitemap_" . $lang . '_';

// FS stop

 

2) function SaveFile($data, $type){

 

$filename = $this->savepath . $this->filename . $type;

// FS start

if ($type == 'index') {

$filename = $this->savepath . 'sitemap' . $type;

}

// FS stop

 

3) // FS start

//foreach ( glob($this->savepath . $pattern, GLOB_BRACE) as $filename ) {

// if ( eregi('index', $filename) ) continue;

// if ( eregi('manufacturers', $filename) && GOOGLE_XML_SITEMAP_CREATE_MANU != 'true' ) continue;

// if ( eregi('pages', $filename) && GOOGLE_XML_SITEMAP_CREATE_PAGES != 'true' ) continue;

// if ( eregi('specials', $filename) && GOOGLE_XML_SITEMAP_CREATE_SPECIALS != 'true' ) continue;

 

$filename = DIR_FS_CATALOG . 'sitemap_4_products.xml';

if (file_exists($filename)) {

// FS stop

$content .= "\t" . '<sitemap>' . "\n";

$content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n";

$content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n";

$content .= "\t" . '</sitemap>' . "\n";

} # end foreach

// FS start

$filename = DIR_FS_CATALOG . 'sitemap_5_products.xml';

if (file_exists($filename)) {

$content .= "\t" . '<sitemap>' . "\n";

$content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n";

$content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n";

$content .= "\t" . '</sitemap>' . "\n";

}

$filename = DIR_FS_CATALOG . 'sitemap_6_products.xml';

if (file_exists($filename)) {

$content .= "\t" . '<sitemap>' . "\n";

$content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n";

$content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n";

$content .= "\t" . '</sitemap>' . "\n";

}

$filename = DIR_FS_CATALOG . 'sitemap_4_categories.xml';

if (file_exists($filename)) {

$content .= "\t" . '<sitemap>' . "\n";

$content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n";

$content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n";

$content .= "\t" . '</sitemap>' . "\n";

}

$filename = DIR_FS_CATALOG . 'sitemap_5_categories.xml';

if (file_exists($filename)) {

$content .= "\t" . '<sitemap>' . "\n";

$content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n";

$content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n";

$content .= "\t" . '</sitemap>' . "\n";

}

$filename = DIR_FS_CATALOG . 'sitemap_6_categories.xml';

if (file_exists($filename)) {

$content .= "\t" . '<sitemap>' . "\n";

$content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n";

$content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n";

$content .= "\t" . '</sitemap>' . "\n";

}

// FS stop

 

Explanation:

 

So I am working with 3 languages 4, 5 and 6. I run the index program for each language with parameter language, so index.php?language=4 (or 5 or 6). When I run the last language my sitemapindex.xml is complete.

 

Like you said is not easy to do it quite automatically, costs time and I don't have because it is not a hobby for me. But so it works quickly with a few changes.

 

When this program (index.php) is run as a cronjob (for me 3x) you get the errors with paths for some statements. So that has to fixed also. Best is maybe to start with a chgdir for the catalog path and after to change extra where necessary. For statements like fopen, I thought you have to use always the full path, so not a relative path (in a cronjob).

Edited by Felix Scheiffers
Link to comment
Share on other sites

Additional explanation (I forgot) :

 

- this contribution use e.g. sitemapproducts.xml and sitemapcategories.xml (I used this ones only in my case)

- so for every language you have to create before (in my case) sitemap_4_products.xml, sitemap_5_products.xml etc. (so you can remove sitemapproducts.xml and sitemapcategories.xml)

Link to comment
Share on other sites

Thanks for posting your code. It may help others. As for making it easier, you could creat duplicates of the index file, each one setup for a different language and then run a cron job for each. It will be a little more work at first but then it would all be automatic.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks for posting your code. It may help others. As for making it easier, you could creat duplicates of the index file, each one setup for a different language and then run a cron job for each. It will be a little more work at first but then it would all be automatic.

 

Hi Jack,

 

Thanks for your answer and I understand now what you meant.

 

Because a cron job does not understand parameters like ?language=4.

 

So you have to create in my case e.g. index_4.php, index_5.php and index_6.php and each with hard coded $language_id=4 etc.

 

So you have to change inside index_4.php (or 5 or 6) :

 

1) // FS start

$languages_id = 4; or 5 or 6

//include_once(DIR_WS_CLASSES . 'language.php');

//$lng = new language();

//$languages_id = $lng->language['id'];

// FS stop

 

In my case it was enough to change to first statement chdir (in index_4.php etc.) to the full path for the catalog (because for my options I have not to deal with fopen in the programs, so I got no extra errors).

Edited by Felix Scheiffers
Link to comment
Share on other sites

I'd be interested in knowing how google handles all of the maps - whether they accept all of the links or not. On a site, two links to the same product with the language set can be considered duplicate pages. If they see that as the case in the maps, they will refuse some of the entries. If they accept them, then I would expect the total number of accepted links per language is the same for all languages.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I'd be interested in knowing how google handles all of the maps - whether they accept all of the links or not. On a site, two links to the same product with the language set can be considered duplicate pages. If they see that as the case in the maps, they will refuse some of the entries. If they accept them, then I would expect the total number of accepted links per language is the same for all languages.

It can not be a problem because the links are seo-links, so all the text for every language is different, so there is not 1 duplicated link for all languages together (except the productnumber/categorynumber inside the link)!

And I think they can't see the link to the same product_info.php pages for example, that's happening in the .htaccess translation inside the server ... it looks for them different pages I guess ...

In fact they lead all to the default language because the language is not part of the seo link. But I don't think they compare the contents (text) of the pages, otherwise the language must be made a part of the seo-link like -en or -ge or -du etc. so being translated to product_info?language= in stead of only product_info.

I let you know my own experiences within 3-4 days ... that's the time it normally takes Google will handle the sitemaps (my experience)...

Edited by Felix Scheiffers
Link to comment
Share on other sites

Hi there,

 

I have a problem with this contribution. I have also the Ultimate_SEO_URLSv22d_5 installed, in which I defined, how special characters should be converted. But the googlexml-sitemap ignores them and leaves the url without the characters.

 

Do You have any suggestions on this issue?

Link to comment
Share on other sites

Hi there,

 

I have a problem with this contribution. I have also the Ultimate_SEO_URLSv22d_5 installed, in which I defined, how special characters should be converted. But the googlexml-sitemap ignores them and leaves the url without the characters.

 

Do You have any suggestions on this issue?

I tested it here and it is working correctly for names with special characters. You need to be sure cache is cleared since that can cause something like this. Go to the settings in admin and use the reset or uninstall option and then go to the site and click on home. If it still fails, go back into the settings and turn off the SEO cache and categories cache, refresh your home page and try again. Once it is working, those settings can be turned back on. A new version of Ultimate SEO will be out soon so that might help although I tried the previous version and it worked too.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I tested it here and it is working correctly for names with special characters. You need to be sure cache is cleared since that can cause something like this. Go to the settings in admin and use the reset or uninstall option and then go to the site and click on home. If it still fails, go back into the settings and turn off the SEO cache and categories cache, refresh your home page and try again. Once it is working, those settings can be turned back on. A new version of Ultimate SEO will be out soon so that might help although I tried the previous version and it worked too.

 

Thanks for Your support I´ll try that...

Link to comment
Share on other sites

Hi,

 

When I click the sitemappages.xml link in the sitemapindex file it says the page cann't be opened. (My guess is that there aren't any links to show in this file, because I had the same page show up when I didn't had any specials added)

Enable standard pages is set to true.

 

That's probably the reason why my sitemapindex.xml file status reports "error"

If I just remove the sitemappages.xml from my root folder, will this be enough to get rid of the error?

Because I rather have my standard pages not indexed.

 

Isn't it also usefull to place a link to the sitemapindex.xml in robots.txt?

So other robots can find the sitemap too?

 

 

Kind regards

Link to comment
Share on other sites

Same sort of problem as perderb except my config files are fine.

 

As of Crimbo Eve it stopped generating. The only thing that had been done prior was to install the google base feed. I cant see anywhere where I would affect the sitemap though.

 

Permissions are all correct, tried replacing with the stock xml files but still get the error. Anyone have any pointers?

 


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

ERROR: Google Product Sitemap Generation FAILED!



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

ERROR: Google Category Sitemap Generation FAILED!



Warning:  fopen(/sitemappages.xml) [function.fopen]: failed to open stream: Permission denied in /home/ukgaming/public_html/googlesitemap/sitemap.class_Alternate.php on line 354

ERROR: Google Pages Sitemap Generation FAILED!



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

ERROR: Google Sitemap Index Generation FAILED!

Array
(
   [QUERY] => Array
       (
           [PRODUCTS] => Array
               (
                   [sTATUS] => success
                   [NUM_ROWS] => 18
               )

           [CATEOGRY] => Array
               (
                   [sTATUS] => success
                   [NUM_ROWS] => 7
               )

       )

   [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] => /sitemappages.xml
                   [status] => failure
                   [file_exists] => false
               )

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

       )

)

Link to comment
Share on other sites

The pages sitemap won't show in the index file if you turn the option for it off in admin.

 

Yes, there should be an entry in the robots file.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The pages sitemap won't show in the index file if you turn the option for it off in admin.

Enable standard pages is now set to false

When I open sitemapindex.xml there still is a link to sitemappages.xml

 

Are there other options to get rid of the sitemappages.xml?

 

 

Thanx

Link to comment
Share on other sites

Enable standard pages is now set to false

When I open sitemapindex.xml there still is a link to sitemappages.xml

 

Are there other options to get rid of the sitemappages.xml?

You have to run the script after making setting changes for them to work.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

You have to run the script after making setting changes for them to work.

That's what I did!?

 

First I pointed my browser to googlesitemap/index.php (when I run this script, it doesn't mention that sitemappages.xml is created.)

 

And then I opened sitemapindex.xml The link to sitemappages.xml was still there...

Link to comment
Share on other sites

Maybe the permissions on the sitemapindex.php file are incorrect, preventing it from being written to. Try replacing it with the original from the contribution and run the script again to see if that is the caze.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Maybe the permissions on the sitemapindex.php file are incorrect, preventing it from being written to. Try replacing it with the original from the contribution and run the script again to see if that is the caze.

Replacing the files with the original ones solved the problem of the sitemappages.xml file

 

I submitted the sitemap again to google. Only the status for sitemapindex.xml is still "error"

When I open sitemapindex.xml it shows the 4 other sitemaps with status "OK"

screenshot.gif

 

Any ideas what this might be?

 

Thanx for your fast en good support!

Link to comment
Share on other sites

I submitted the sitemap again to google. Only the status for sitemapindex.xml is still "error"

When I open sitemapindex.xml it shows the 4 other sitemaps with status "OK"

screenshot.gif

 

Any ideas what this might be?

Click on the sitemapindex link on that page and there will be a place to look at the errors so you can know why it is failing.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The entry in the SQL Table is also missing. Run the SQL again?

The sql file only adds the configure settings so it won't hurt to run it. The worst case is that you end up with duplicate settings, which would have to be deleted. The safer way is to check the database first but if you don't know how to do that, then running the file is probably the better way to go.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hi Jack.

 

I have a question about the Google Sitemap SEO in combination with SEO URL 5 by FWR Media.

 

My Url in the shop looks like:

 

http://www.xxxx.de/alpha-vogt-filterelement-fuer-av-16-av-88v-av-88top-34114-p-634.html

 

BUT in the sitemapproducts.xml like(with "standard" option):

 

http://www.xxxx.de/product_info.php?products_id=634

 

Any solution to settle this problem? I try to set the "alternate" option but then I get an error.

 

Thanks.

 

Thomas

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