Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Google XML Sitemap Feed - by Chemo


Guest

Recommended Posts

Chemo,

 

10000x Thank you, I uploaded your contrib. and it went all correct (I wish all the contribs. instruction were as well written as yours!!!) :thumbsup:

 

I uploaded my sitemap to google, I will check back to you the moment it is accepted

 

Denice

( :D second time I'm smilling like this after uploading a contrib, normally I look like this after installing a new contrib  :wacko: )

Thank you for the kind words! I'm glad it worked well for you!

Hey Bobby,

 

Is this contrib written in such a way that it is looking for specific fields in the product tables? Mine fails on the product sitemap but successful with the category sitemap and sitemap index. My products table is nowhere close to stock so if this is the case, I would need to edit the file to reflect the product fields I have deleted and the ones I have added.....

 

Thanks!

The SQL looks like this:

  $sql = "SELECT products_id as pID, products_date_added as date_added, products_last_modified as last_mod, products_ordered 
      FROM " . TABLE_PRODUCTS . " 
   WHERE products_status='1' 
   ORDER BY products_ordered DESC";

So, the only thing that may present the issue is if the products_status is something other than 1.

Hi Bobby, any clues to the following

Cheers

Matt

Very strange...have you modified the file?

 

Bobby

Link to comment
Share on other sites

hey bobby,

 

yea I saw that. i dont use products_date_added and products_last_modified fields (deleted from database) so I modified the SQL to reflect this then I modified the $last_mod variable to something static like:

 

$lastmod = '2006-06-01 17:45:17';

 

It generated the XML files easily (over 2,000 categories and 6,000 products) and I have submitted it to google.

 

do you think I might run into issues down the road by using a static entry for that field?

Link to comment
Share on other sites

The whole point to the feed is to let Google know when things change...so, yes it kind of defeats the purpose.

 

If you arbitrarily insert dates without the content actually changing it will no doubt be bad news...Google is constantly looking that kind of stuff.

 

Bobby

Link to comment
Share on other sites

theman, thanks for your input.

I presume you mean includes/configure.php.

It is appropriately configured for my store environment existing in the root of my web space.

 

These are the relevant settings from my configure.php

define('HTTP_SERVER', 'http://www.compusys.co.nz');
define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));
define('DIR_WS_HTTP_CATALOG', '/');

Link to comment
Share on other sites

The whole point to the feed is to let Google know when things change...so, yes it kind of defeats the purpose.

 

If you arbitrarily insert dates without the content actually changing it will no doubt be bad news...Google is constantly looking that kind of stuff.

 

Bobby

 

thanks. figured as much. I guess if this technology takes off for them I might have to start using that field again in my db....

Link to comment
Share on other sites

Very strange...have you modified the file?

 

Bobby

 

No, haven't made any changes whatsoever. Could this be highlighting a problem with people running their store from the webspace root?

 

Cheers

Matt

 

ps just installed the latest version, still creating .xml files with the googlesitemap/ appended to them

Link to comment
Share on other sites

No, haven't made any changes whatsoever. Could this be highlighting a problem with people running their store from the webspace root?

 

Cheers

Matt

 

ps just installed the latest version, still creating .xml files with the googlesitemap/ appended to them

 

I run it from the root and don't have this problem BUT I did have to change one of the DEFINE statements to get the path to display correctly...I thought it was just my store...

Link to comment
Share on other sites

No, haven't made any changes whatsoever. Could this be highlighting a problem with people running their store from the webspace root?

 

Cheers

Matt

 

ps just installed the latest version, still creating .xml files with the googlesitemap/ appended to them

I don't believe so...I developed it on a store that is root installed (my development server).

Hi,

 

I uploaded my site map 3 hours ago to google, and it is approved

 

Thanks,

Denice

SUCCESS!

 

We have the first verification of XML validation!

 

Thank you Denice :)

 

I run it from the root and don't have this problem BUT I did have to change one of the DEFINE statements to get the path to display correctly...I thought it was just my store...

What did you have to change?

 

Bobby

Link to comment
Share on other sites

What did you have to change?

 

Bobby

 

I had to add:

 

define('DIR_WS_HTTP_CATALOG', '/');

 

to /googlesitemap/index.php. Like I said, I thought it was just my store because it is so custom.....

 

does google notify via email when it is approved? similar to froogle?

Edited by carrerarod
Link to comment
Share on other sites

I think it might have something to do with these code parts:

 

from my configure.php

 

define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));

 

from sitemap.class.php

 

/**

* GoogleSitemap class constructor

* @author Bobby Easland

* @version 1.0

* @param string $host Database host setting (i.e. - localhost)

* @param string $user Database user

* @param string $db Database name

* @param string $pass Database password

*/

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

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

  $this->filename = "sitemap";

  $this->savepath = DIR_FS_CATALOG;

  $this->base_url = HTTP_SERVER . DIR_WS_HTTP_CATALOG;

  $this->debug = array();

} # end class constructor

 

/**

* Function to save the sitemap data to file as either XML or XML.GZ format

* @author Bobby Easland

* @version 1.1

* @param string $data XML data

* @param string $type Feed type (index, products, categories)

* @return boolean

*/

function SaveFile($data, $type){

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

  $compress = defined('GOOGLE_SITEMAP_COMPRESS') ? GOOGLE_SITEMAP_COMPRESS : 'false';

  if ($type == 'index') $compress = 'false';

  switch($compress){

  case 'true':

    $filename .= '.xml.gz';

    if ($gz = gzopen($filename,'wb9')){

    gzwrite($gz, $data);

    gzclose($gz);

    $this->debug['SAVE_FILE_COMPRESS'][] = array('file' => $filename, 'status' => 'success', 'file_exists' => 'true');

    return true;

    } else {

    $file_check = file_exists($filename) ? 'true' : 'false';

    $this->debug['SAVE_FILE_COMPRESS'][] = array('file' => $filename, 'status' => 'failure', 'file_exists' => $file_check);

    return false;

    }

    break;

  default:

    $filename .= '.xml';

    if ($fp = fopen($filename, 'w+')){

    fwrite($fp, $data);

    fclose($fp);

    $this->debug['SAVE_FILE_XML'][] = array('file' => $filename, 'status' => 'success', 'file_exists' => 'true');

    return true;

    } else {

    $file_check = file_exists($filename) ? 'true' : 'false';

    $this->debug['SAVE_FILE_XML'][] = array('file' => $filename, 'status' => 'failure', 'file_exists' => $file_check);

    return false;

    }

    break;

  } # end switch

} # end function

 

I've highlighted on bold red the lines that my be causing my problem.

 

Cheers

Matt

Link to comment
Share on other sites

Change:

define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));

to:

define('DIR_FS_CATALOG', '/path/to/your/doc/root/');

 

Bobby

Link to comment
Share on other sites

yeah, I kinda figured that might be the problem, but I have to first discover the origin of that define, whether it's stock code or a custom configuration from a contribution, so I don't break my store.

 

Cheers

Matt

Link to comment
Share on other sites

can you re-upload the original index.php and sitemap.class.php file to the googlesitemap directory ?

to make sure no typo's slipped in ?

 

then next question is, what is your setup (using any of chemo's contributions? ), standard MS2 or a loaded release or anything else peculiar ?

PHP4 or 5 ?

 

I have re-uploaded the latest files and still the same:

 

Internal Server Error:

Premature end of script headers: php-script

 

 

Seo url and page cache are installed on a MS2 oscmmerce site.

 

We are using PHP Version 4.3.8.

 

Anyone an idee ?

 

Thanks,

 

Hans

Link to comment
Share on other sites

I have the following error, when I am trying to run the index.php:

 

Generated Google Product Sitemap Successfully

Generated Google Category Sitemap Successfully



Fatal error:  Call to undefined function:  glob() in .../htdocs/shop/catalog/googlesitemap/sitemap.class.php on line 372

 

Can somebody please help me?

 

Alexander Wolf

Link to comment
Share on other sites

Keukenlust has been 'fed' to google :) - it took approximately 4 hours.

 

Hans,

Perhaps it's the combination of seo url and page cache causing trouble.

Did you install the latest contribution from chemo, he made some more updates yesterday. Worthwile to get the latest and if it still doesn't work, I guess some serious debugging is going to be needed.

I'd start with commenting out whole chuncks of code from the index.php file to see at which point it no longer compiles.

Edited by bruyndoncx

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Keukenlust has been 'fed' to google :) - it took approximately 4 hours.

 

Hans,

Perhaps it's the combination of seo url and page cache causing trouble.

Did you install the latest contribution from chemo, he made some more updates yesterday. Worthwile to get the latest and if it still doesn't work, I guess some serious debugging is going to be needed.

I'd start with commenting out whole chuncks of code from the index.php file to see at which point it no longer compiles.

 

 

Ok I start with the commenting out the code. I keep you informed.

 

Thanks for the help.

 

Hans

Link to comment
Share on other sites

Bobby,

 

I added the define('DIR_FS_CATALOG', '/path/to/my/root etc....

 

directly to /googlesitemap/index.php, so as not to break any other contributions.

The files were created correctly when I executed it again.

 

Google has come and gone and they report 'OK' at 'Google Sitmaps'

 

Success.

 

Cheers

Matt

Link to comment
Share on other sites

Hi Bobby

Great contribution :thumbsup: , i thought all was going well until i got my cron report e:mail this morning. All the files etc are installed and execute fine as stated in your "spot on" instructions. However the e:mail i got this morning says the following:

The ****** i've added for security. (not sure if i needed to though)

 

/home/******/public_html/googlesitemap/index.php: line 1: ?php: No such file or directory

/home/******/public_html/googlesitemap/index.php: line 2: /**: No such file or directory

/home/******/public_html/googlesitemap/index.php: line 3: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 4: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 5: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 6: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 7: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 8: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 9: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 10: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 11: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 12: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 13: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 14: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 15: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 16: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 17: Images: command not found

/home/******/public_html/googlesitemap/index.php: line 18: Images/: is a directory

/home/******/public_html/googlesitemap/index.php: line 20: syntax error near unexpected token `'../''

/home/******/public_html/googlesitemap/index.php: line 20: ` chdir('../');'

 

Any ideas on whether this is something i have done wrong, or if theres a problem with the coding somewhere? I'm using your cache, your URL's and favoured cache images contributions. Just in case they may have something to do with it.

Heres my SITE

 

Thanks in advance Bobby.

ps: It is also your latest URL updated version from late yesterday.

 

Julian

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Link to comment
Share on other sites

My /googlesitemap/index.php is empty :'(

 

Installed version 1 saturday and it worked. Saw the dateerror on google and therefore installed version 1.3 today. When entering /googlesitemap/index.php on my site I see nothing at all. Theres no err.msg's and the html rendered reads:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>

 

 

Installed "Ultimate SEO URLs v2.1" today as well, but thought that the issues with the two living together were solved?

 

Suggestions anyone (Bobby)?

Link to comment
Share on other sites

Getting the following error when I do:

 

........./googlesitemap/index.php

 

 

Fatal error: Call to undefined function: tep_get_parent_categories() in /home/bruinenfit.nl/public_html/shop/includes/seo_cache.php on line 175

 

Installed also the new Ultimate SEO

 

Removed that file from catalog/includes/ now it's ok.

Edited by misa
Link to comment
Share on other sites

hi everyone. I have just got off of instant messenger with chemo, who for as yet unexplained reasons has been banned from this forum. He cannot post any comments, nor can he even view the problems that others have posted. Obviously it is too early to pass judgement on the powers that be as to why this has happened, but Chemo wanted me to post this comment to all people looking for his valuable support and help. The comment below is his work, and if as a result of posting it I get banned, then you can make your own decisions about what that says about the state of the osc forums. Anyway, this is what he says:

 

osCommerce Community,

 

I was banned from the forum and will no longer be able to offer support for my contributions.  I apologize to the osC community members that would have benefited from not only my future support but also the contributions that would have been released.

 

Good luck in the future and I wish you all the best in achieving your goals.

 

Cordially,

 

Bobby

 

Sorry to everybody who would have benefitted from his expertise, and hopefully we can sort out any differences between him and the osc team to get such a valuable community member back into the osc family.

Please note - if I have suggested a contrib above, it doesnt mean it will work! Most of the contribs are not ones I've used, but may be useful for your particular problem....

Have you tried a refined search? Chances are your problem has already been dealt with elsewhere on the forums.....

if (stumped == true) {

return(square_one($start_over)

} else {

$random_query = tep_fetch_answer($forum_query)

}

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