Jump to content
Jack_mcs

Google XML Sitemap SEO

Recommended Posts

It looks like a path problem. You might want to read through this thread to see fixes for that.

 

Jack

Share this post


Link to post
Share on other sites
It looks like a path problem. You might want to read through this thread to see fixes for that.

 

Jack

 

Jack

 

Are you saying it might be a path problem becuase the full paths are not shown in the error? I removed the full path because I did not want to show them here on the forum. I will search and see what I can find.

 

Everything was working fine until I wanted to change it to "Products Viewed".

 

Thanks!

Edited by projman

Share this post


Link to post
Share on other sites

Yes, that is what I meant. If that is not the correct output, then I don't know what the problem is. I don't provide support for specially coded projects so you will need to figure that one out yourself.

 

Jack

Share this post


Link to post
Share on other sites

Jon I have the same problem. Let me know if you figure out what fixes that. I will do the same if I figure it out.

 

Thanks.

Share this post


Link to post
Share on other sites

Hi Jack, Thx for the contribution. I have downloaded the latest from the 6th March but having problems with specials. We dont have any specials but still the sitemapindex.xml file is still showing the line

 

<sitemap>

<loc>http://www.fantaby.se/foretag/shop/sitemapspecials.xml</loc>

<lastmod>2009-03-15</lastmod>

</sitemap>

 

because of this we are getting an error message from Google saying the sitemapspecials.xml file is empty. I would have thought that if there were no specials, this code would have been left out/deleted from the sitemapindex.xml file so that Google wouldnt be led to the empty file. Or has something gone wrong with just our installation?

 

Many thanks/ Luke

Share this post


Link to post
Share on other sites
Jon I have the same problem. Let me know if you figure out what fixes that. I will do the same if I figure it out.

 

Thanks.

Hi Jason,

 

I think I fixed it - Try This:

	function GenerateProductSitemap(){
      $sql = "SELECT p.products_id as pID, p.products_date_added as date_added, p.products_last_modified as last_mod, p.products_ordered, pd.products_viewed as viewed
               FROM " . TABLE_PRODUCTS . " p left join " .
               TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id = pd.products_id)  
               WHERE products_status='1' 
               ORDER BY pd.products_viewed DESC";
	if ( $products_query = $this->DB->Query($sql) ){
		$this->debug['QUERY']['PRODUCTS']['STATUS'] = 'success';
		$this->debug['QUERY']['PRODUCTS']['NUM_ROWS'] = $this->DB->NumRows($products_query);
		$container = array();
		$number = 0;
		$top = 0;
		while( $result = $this->DB->FetchArray($products_query) ){
			$top = max($top, $result['viewed']);
			$location = $this->hrefLink(FILENAME_PRODUCT_INFO, 'products_id=' . $result['pID'], 'NONSSL', false);
			$lastmod = $this->NotNull($result['viewed']) ? $result['viewed'] : $result['date_added'];
			$changefreq = GOOGLE_SITEMAP_PROD_CHANGE_FREQ;
			$ratio = $top > 0 ? $result['viewed']/$top : 0;
			$priority = $ratio < .1 ? .1 : number_format($ratio, 1, '.', ''); 

			$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 ? 'products' : 'products' . $number;
				$this->GenerateSitemap($container, $type);
				$container = array();
				$number++;
			}
		} # end while
		$this->DB->Free($products_query);			
		if ( sizeof($container) > 1 ) {
			$type = $number == 0 ? 'products' : 'products' . $number;
			return $this->GenerateSitemap($container, $type);
		} # end if			
	} else {
		$this->debug['QUERY']['PRODUCTS']['STATUS'] = 'false';
		$this->debug['QUERY']['PRODUCTS']['NUM_ROWS'] = '0';
	}
} # end function

Share this post


Link to post
Share on other sites
Hi Jack, Thx for the contribution. I have downloaded the latest from the 6th March but having problems with specials. We dont have any specials but still the sitemapindex.xml file is still showing the line

 

 

 

because of this we are getting an error message from Google saying the sitemapspecials.xml file is empty. I would have thought that if there were no specials, this code would have been left out/deleted from the sitemapindex.xml file so that Google wouldnt be led to the empty file. Or has something gone wrong with just our installation?

 

Many thanks/ Luke

Code was posted a few pages back to remove the manufacturers entry. You can use the same for specials by applying it to the specials section.

 

Jack

Share this post


Link to post
Share on other sites
Hi Jason,

 

I think I fixed it - Try This:

	function GenerateProductSitemap(){
      $sql = "SELECT p.products_id as pID, p.products_date_added as date_added, p.products_last_modified as last_mod, p.products_ordered, pd.products_viewed as viewed
               FROM " . TABLE_PRODUCTS . " p left join " .
               TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id = pd.products_id)  
               WHERE products_status='1' 
               ORDER BY pd.products_viewed DESC";
	if ( $products_query = $this->DB->Query($sql) ){
		$this->debug['QUERY']['PRODUCTS']['STATUS'] = 'success';
		$this->debug['QUERY']['PRODUCTS']['NUM_ROWS'] = $this->DB->NumRows($products_query);
		$container = array();
		$number = 0;
		$top = 0;
		while( $result = $this->DB->FetchArray($products_query) ){
			$top = max($top, $result['viewed']);
			$location = $this->hrefLink(FILENAME_PRODUCT_INFO, 'products_id=' . $result['pID'], 'NONSSL', false);
			$lastmod = $this->NotNull($result['viewed']) ? $result['viewed'] : $result['date_added'];
			$changefreq = GOOGLE_SITEMAP_PROD_CHANGE_FREQ;
			$ratio = $top > 0 ? $result['viewed']/$top : 0;
			$priority = $ratio < .1 ? .1 : number_format($ratio, 1, '.', ''); 

			$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 ? 'products' : 'products' . $number;
				$this->GenerateSitemap($container, $type);
				$container = array();
				$number++;
			}
		} # end while
		$this->DB->Free($products_query);			
		if ( sizeof($container) > 1 ) {
			$type = $number == 0 ? 'products' : 'products' . $number;
			return $this->GenerateSitemap($container, $type);
		} # end if			
	} else {
		$this->debug['QUERY']['PRODUCTS']['STATUS'] = 'false';
		$this->debug['QUERY']['PRODUCTS']['NUM_ROWS'] = '0';
	}
} # end function

 

 

That worked wonderfully. Not sure what you did. Perhaps Ill have more time later to compare. Thanks a lot Jon.

Share this post


Link to post
Share on other sites

Hi Jack.

 

Thank you for the update. It's working perfectly.

 

May I ask, what is the advantage of the extra feeds?, and have 'new products' been omitted for a reason?

What about our static pages? conditions, shipping etc (I also have a few tutorials). Would it be worth me manually creating another XML file for these pages?

 

Thanks.

 

Ken

Share this post


Link to post
Share on other sites

New products will show up in the products sitemap. A separate sitemap could be created for those but since they would be duplicates, I don't think it would gain anything.

 

I toyed with the idea of adding a sitemap for the static pages but those are usually of less importance and the search engines will find them quick enough on their own, especially if an on-site sitemap contribution is installed. So I'm not sure I will be changing the code for that but it might be a good idea to create a separate one for those. It could be done manually in a few minutes, using one of the sitemaps from this contribution as a guide, and isn't something that would change, at least not often. It may not make a big difference but any exposure is better than none.

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack.

 

Thanks for the info.

 

A separate sitemap could be created for those but since they would be duplicates

 

Well the specials.xml is also a duplicate.

 

I have (for example)

 

http://mysite/product_info.php?products_id=312

 

in the sitemapspecials.xml. And then it is repeated in sitemapproducts.xml

 

Surely this is a duplicate in the same way that new products would be?

 

Regards.

 

Ken.

Share this post


Link to post
Share on other sites

Yes, they also appear. My thinking is that a new products sitemap would be more likely to be empty. Although, as some have mentioned, so is the specials and manufacturers so I will probably change the code to allow those to be options.

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack.

 

Thanks for your reply.

 

I will remove the sitemapspecials.xml and edit it from sitemapindex.xml.

I look forward to the update.

 

Regards.

 

Ken.

Share this post


Link to post
Share on other sites
That worked wonderfully. Not sure what you did. Perhaps Ill have more time later to compare. Thanks a lot Jon.

 

Jason,

 

I found another error:

 

Locate this line in the function:

$lastmod = $this->NotNull($result['viewed']) ? $result['viewed'] : $result['date_added'];

 

Change it back to the original line:

$lastmod = $this->NotNull($result['last_mod']) ? $result['last_mod'] : $result['date_added'];

 

If I find anything else, I will let you know, but it looks good now.

Edited by projman

Share this post


Link to post
Share on other sites

I found some issues with the original contribution by Chemo that I used.

Google started to show errors and redirects in my Webmaster Tools sitemaps.

 

Looking for a solution I found your *updated* version and I suddenly discovered that I was using an incomplete version since day 1 :blush:

 

Your installation was easy and it worked out of the box.

 

Just one question: Which files should I remove from the domain.com/googlesitemap/ to be on the safe side?

 

Thanks.


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites

You don't need to remove any files. Just upload the ones from this contribution. They are all the same except for a few.

 

Jack

Share this post


Link to post
Share on other sites
You don't need to remove any files. Just upload the ones from this contribution. They are all the same except for a few.

 

Jack

 

Thanks, but that is not what I mean, sorry for that.

 

In the googlesitemap map there are a lot of files, one is an index.html whit installation instructions.

This googlesitemap is accessable via your browser and thus can someone see the install instruction.

I removed that file so now there is only the index.php which will generate the sitemaps.xml files.

 

Just want to know if that construction is safe or do I need to remove other files or change the access rights?


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites

You can remove that if you want. The contents of that directory is known to anyone familiar with the contribution so having the install instructions doesn't provide any information that can hurt a site.

 

Jack

Share this post


Link to post
Share on other sites
You can remove that if you want. The contents of that directory is known to anyone familiar with the contribution so having the install instructions doesn't provide any information that can hurt a site.

 

Jack

 

Thanks!


Norman in 't Veldt

 

Moderator

osCommerce The Netherlands

Share this post


Link to post
Share on other sites

Hi could someone post a link to the install file please after I have downloaded the package to my desktop I click on install file and it says I should be redirected but it never happens so I cant view the instructions.

Thanks in Advance

Lori

Share this post


Link to post
Share on other sites

You need to extract the contents and then click on install.

 

Jack

Share this post


Link to post
Share on other sites
You need to extract the contents and then click on install.

 

Jack

Hi jack Thanks for your reply I have installed a few contributions on my site already so I know how to open a zip file etc but I when I try to get the link for the instal documents I.E. does not show the document just tells me I am being redirected which never happens.

Share this post


Link to post
Share on other sites

My reply had nothing to do with opening the zip file. The way the install document was written won't allow it to be ran from within the zip file. Have you extracted the contents of the zip file and placed them somewhere on your computer and clicked on the install file from there?

 

Jack

Share this post


Link to post
Share on other sites
My reply had nothing to do with opening the zip file. The way the install document was written won't allow it to be ran from within the zip file. Have you extracted the contents of the zip file and placed them somewhere on your computer and clicked on the install file from there?

 

Jack

Hi Jack Thanks again for your support tried that, didn't work on the pc but managed to get it from the laptop obviously an issue with my old desktop. I have installed a couple of your contribs so far with no problem and just thought I'd say thanks a million for your hardwork.

Lori

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

×