Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google XML Sitemap SEO


Jack_mcs

Recommended Posts

I recommend the following changes to the sitemap.class.php

 

instead of encoding - use decode for the google webmasters url generation

	function GenerateSubmitURL(){
		$url = urldecode($this->base_url . 'sitemapindex.xml');
		return htmlspecialchars(utf8_decode('http://www.google.com/webmasters/sitemaps/ping?sitemap=' . $url));
	} # end function

"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Link to comment
Share on other sites

Is there a setting needed to show information.php pages?

I see the /*** ADD INFORMATION PAGES ***/   code in the class file but on my sitemappages.xml file there are no info pages listed.

I see admin has enable Articles, but no entry for enable Information Pages? just checking

Everything else is working well as far as I can see, no errors, all the pages generate fine. Alternate class fails. store is 2.3.3.4, addon is 1.6

-Dave

Link to comment
Share on other sites

No, there isn't anything else needed other than, of course, for the Information Pages addon to be installed. There are a number of addons that are similar but the code is meant to work with this one.

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

 

Jack,

typo above, yes I am using Contribution Version: 2.0.5 by Slick303, I messed with this all last night but I cannot figure out why my info pages are not showing up..

 

Ughh - just noticed information.php on my exclude list... how the heck that happened I dunno.

 

Comparing to the clean package, I have these extra entries.... information.php should be removed...  Should product_info be there?

 


28 => 'information.php',

  29 => 'password_reset.php',

  30 => 'product_info.php',

  31 => 'tell_a_friend.php'

-Dave

Link to comment
Share on other sites

@@Jack_mcs

 

removing information.php from exclude list solves info pages not showing, but "information.php" by itself (Page not found error) now also is generated... Any way to exclude that without excluding all the legit info pages?

-Dave

Link to comment
Share on other sites

@@Roaddoctor You're right, that is incorrect. I never noticed that before. Please try this. In the sitemap.class.php (or the alternate if you use it), find

      if (! in_array($filename, $this->excludeList) && $this->IsViewable($root . $filename))
      {
        $r = @stat($filename);
        $displayName = ucwords(str_replace("_", " ", substr($filename, 0, strpos($filename, ".")))); //remove the .php and underscores
        $pagesArray[] = array('filename' => $this->base_url . $filename,
                              'lastmod' => gmstrftime ("%Y-%m-%d", $r[9]));

and change it to

      if ($this->IsViewable($root . $filename))
      {
        if (! in_array($filename, $this->excludeList)) {
          $r = @stat($filename);
          $displayName = ucwords(str_replace("_", " ", substr($filename, 0, strpos($filename, ".")))); //remove the .php and underscores
          $pagesArray[] = array('filename' => $this->base_url . $filename,
                                'lastmod' => gmstrftime ("%Y-%m-%d", $r[9]));
        }

Then use the exclude pages option and enter in information.php, product_info.php and whichever others ones should be excluded.

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

A new version has been uploaded with these changes:

 

- Added code to set the last modified date if the date is 0. If this happens, it may mean there is a problem with the database.
- Added a bunch of files to the excludes list to prevent them from showing in the pages site map file.
- Added code to include reviews in the pages file.
- Changed code to handle the exclude list correctly.
- Changed mysql file so it works with newer versions of mysql.
- Removed extra showmanufacturers statement fron index.php - found by Melanie (mommaroodles ).

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

  • 4 weeks later...
  • 1 month later...

There isn't an easy way. I started adding the code but never completed it. I think that if you change this line in googlesitemap/index.php

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

to this

$languages_id = XX;

where XX is the language ID of the other language, the files will be created in that language. This has to be done manually, of course, and the resulting sitemap files would have to be renamed since they would be overwritten when the other language is ran.

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! I have SPPC and Hidden Products installed. Does anyone know what changes I would need to make to exclude hidden products from showing up? Thanks for any help :)

 

you need to add

where p.products_status = '1'

or

WHERE c.categories_status = 1

at the appropriate places

-Dave

Link to comment
Share on other sites

As long as there is a link to the other language, like in a language box, the search engines will find the other url's. But the maps speeds that process up so they would help.

Edited by Jack_mcs

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

  • 3 months later...

I am trying to make some changes to the code to match my shop. I have 4 manufacturers set up. I don't know how to explain it, not just 4 individual manufacturers but I have coded the site to have 4 different manufacturers available (label, artist, genre, condition). I would like to have sitemaps for each of those manufacturers. 

 

I have added the database tables for sitemap true/false selection and set those to true.  I have added the dummy xml files and set the permissions to 755. I have edited index.php and sitemap.class.php. Somewhere in these two files I've made a mistake and I cannot figure it out. 

 

When I run the index.php in my browser it runs fine, however it just flat out stops after creating the first manufacturer sitemap. Diagnosis shows nothing. No errors whatsoever it just stops and never creates the sitemap.xml for the other manufacturers. 

 

Here is my manufacturers code from sitemap.class.php where I do think the error is. 

		function GenerateManufacturer2Sitemap(){
        $sql = "SELECT manufacturers2_id as m2ID, date_added, last_modified as last_mod, manufacturers2_name
                FROM " . TABLE_MANUFACTURERS2 . " order by manufacturers2_name DESC";

		if ( $manufacturers2_query = $this->DB->Query($sql) ){
			$this->debug['QUERY']['MANUFACTURERS2']['STATUS'] = 'success';
			$this->debug['QUERY']['MANUFACTURERS2']['NUM_ROWS'] = $this->DB->NumRows($manufacturers2_query);
			$container = array();
			$number = 0;
			while( $result = $this->DB->FetchArray($manufacturers2_query) ){
				$location = $this->hrefLink(FILENAME_DEFAULT, 'manufacturers2_id=' . $result['m2ID'], 'NONSSL', false);
				$lastmod = $this->NotNull($result['last_mod']) ? $result['last_mod'] : $result['date_added'];
				$changefreq = GOOGLE_SITEMAP_MAN2_CHANGE_FREQ;
				$priority = .5;

				$container[] = array('loc' => htmlspecialchars(utf8_encode($location)),
				                     'lastmod' => date ("Y-m-d", strtotime($lastmod)),
									 'changefreq' => $changefreq,
									 'priority' => $priority
				                     );
				if ( sizeof($container) >= 50000 ){
					$type = $number == 0 ? 'manufacturers2' : 'manufacturers2' . $number;
					$this->GenerateSitemap($container, $type);
					$container = array();
					$number++;
				}
			} # end while
			$this->DB->Free($manufacturers2_query);
			if ( sizeof($container) > 0 ) {
				$type = $number == 0 ? 'manufacturers2' : 'manufacturers2' . $number;
				return $this->GenerateSitemap($container, $type);
			} # end if			
		} else {
			$this->debug['QUERY']['MANUFACTURERS2']['STATUS'] = 'false';
			$this->debug['QUERY']['MANUFACTURERS2']['NUM_ROWS'] = '0';
		}
	} # end function

It' seemed like it would be such a simple thing to do, but I have reread those lines over and over and I do not see where I could have messed up. 

 

Can anyone help?

Link to comment
Share on other sites

Try replacing all of the code in GenerateManufacturer2Sitemap with that in GenerateManufacturerSitemap and see if it works, which it should. If it does, then it is just a matter of swapping the lines until you find the problem.

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 found the error. 

 

The code I was using had this:

$this->DB->

when it should have had this:

tep_db_

Working like a charm now! 

Thank you so much Jack! You're a great supporter of your contributions! I really do appreciate all your hard work!

Link to comment
Share on other sites

  • 3 weeks later...

After I generated the sitemaps it says CONGRATULATIONS! All files generated successfully. When I go to the sitemaps they are empty.

Permissions are set to 777. Any ideas why it is not writing to the files.

"Do what I'm thinking Not what I said." https:windowanddoorparts.us

Link to comment
Share on other sites

Hi Jack

 

I have this Add-on now running for few months and i add products to my store as the weeks go by. So i thought i check out the sitemaps to make sure that all new added products get correctly indexed.

I am all new to this SEO stuff and therefore might have 1 or 2 silly questions.

 

Does this add-on update the sitemaps automatically?

 

I added a bunch of new products in the past 2 weeks but when generating the sitemaps i can't see the new new products added.

Looked at the Webmaster Tools...same there. I can only view older products that date 2 months back.

Do I have to change some settings in the Webmaster Tools area?

I always thought after adding new products i just need to generate new sitemaps with the link in your read me file and that's it. 

 

Any guidance is highly appreciated.

Edited by Tsimi
Link to comment
Share on other sites

OK, i think i understood now how it works.

I didn't refresh the sitemaps in the Webmaster Tools page.

After i clicked on "resubmit sitemap" i needed to click on the refresh link. Now they show just fine and google will hopefully send it's crawlers.

Same goes for the direct links to the sitemaps (example: *MYURL*/sitemapproducts.xml) once entered the URL just refresh with F5 and the new products get listed nicely as they should.

 

Thanks again.

Link to comment
Share on other sites

You shouldn't need to do anything once it is setup correctly. You should set up a cron job to run the script if you haven't. That will keep your maps current. In webmaster tools, all you really need to do is add the sitemapindex.php map but it is better to add all of the ones you are using since errors are easier to see. Once that's all done and the maps are not getting any errors In webmaster tools, you don't need to do anything else at all.

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

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