Jump to content
Jack_mcs

Google XML Sitemap SEO

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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 ).

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

My store has 2 languages, english and french. My admin is in english. The sitemaps are generated only in english. Is there a way to have sitemaps generated for both languages?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks Jack, as I suspected. I'll take a look at the code myself and see if I can figure it out, just wanted to know if it had been done. I guess it's a good thing to do, no?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

To the above post

Using OSC 2.3.4


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

Share this post


Link to post
Share on other sites

What happens when you switch to the alternate option? What is the output of the test option?

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

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

×