Jump to content
Jack_mcs

Google XML Sitemap SEO

Recommended Posts

Thank you to @@Jack_mcs and @@bruyndoncx for the solution

 

If you are using enable/disable categories addon, in sitemap.class.php (&/or sitemap.class_Alternate.php if you use that)

 

FIND

/**
* Funciton to generate category sitemap data
* @[member='author'] Bobby Easland
* @version 1.1
* @[member='Return'] boolean
*/
function GenerateCategorySitemap(){
 $quotes = (defined('QUOTES_CATEGORY_NAME') ? " where cd.categories_name NOT LIKE '" . QUOTES_CATEGORY_NAME . "' " : '');
$sql = "SELECT c.categories_id as cID, c.date_added, c.last_modified as last_mod
 FROM " . TABLE_CATEGORIES . " c left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on c.categories_id = cd.categories_id
	 " . $quotes . "
ORDER BY c.parent_id ASC, c.sort_order ASC, c.categories_id ASC";

 

REPLACE WITH

/**
* Funciton to generate category sitemap data - modified for category enable/disable addon
* @[member='author'] Bobby Easland
* @version 1.1
* @[member='Return'] boolean
*/
function GenerateCategorySitemap(){
 $quotes = (defined('QUOTES_CATEGORY_NAME') ? " and cd.categories_name NOT LIKE '" . QUOTES_CATEGORY_NAME . "' " : '');
$sql = "SELECT c.categories_id as cID, c.date_added, c.last_modified as last_mod
 FROM " . TABLE_CATEGORIES . " c left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on c.categories_id = cd.categories_id
WHERE c.categories_status = 1
	 " . $quotes . "
ORDER BY c.parent_id ASC, c.sort_order ASC, c.categories_id ASC";


-Dave

Share this post


Link to post
Share on other sites

Hi,

 

I am using version 1.6 of this add-on.

 

I have successfully created a store and have since copied database and files to a new domain to create a new store. All is working except when I create and submit sitemapindex.xml from my new store and submit the sitemap to Google it is referencing my other store. htaccess file has been amended for my new store so I don't understand why this is happening? I thought copying the database over would be fine. Would the problem be that I need to run the sql again for the new site?

 

Any help would be appreciated. Thanks!

 

This is the created sitemap index: http://www.illuminiphotography.co.uk/shop/sitemapindex.xml

This is what Google webmaster tools displays under sitemaps and shows an error.

 

http://www.myfairhands.co.uk/sitemapcategories.xml

http://www.myfairhands.co.uk/sitemappages.xml

http://www.myfairhands.co.uk/sitemapproducts.xml

http://www.myfairhands.co.uk/sitemaps.xml

http://www.myfairhands.co.uk/sitemapspecials.xml

 

Errors
Nested indexing
This Sitemap Index is referenced by another Sitemap Index.
1
Sitemap: www.myfairhands.co.uk/sitemaps.xml
URL: http://www.myfairhands.co.uk/sitemapindex.xml

Share this post


Link to post
Share on other sites

The sitemaps themselves are correct so the problem is with how google is setup. It looks like you're using the wrong account for the sitemaps.

Share this post


Link to post
Share on other sites

Thanks Jack!

 

I will delete the sitemapsindex.xml from Google sitemaps and will then generate again and re-submit to see if this corrects the error.

Share this post


Link to post
Share on other sites

I have v1.6 installed however I am having 2 problems:

 

1) I get the "ERROR: Google Pages Sitemap Generation FAILED!" message when trying to create the pages sitemap.

2) In v1.6 where the individual sitemaps are successful I get the "XML Parsing Error: no element found" message when opening the xml page. In v1.5 it was providing links as though they were localhost results.

 

I think they both relate to the WS_CAT / not being populated.

 

This part of the googlesitemap/index.php ouput:

 

Opening   /var/www/vhosts/********.com/sitemapproducts.xml
FS_CAT    /var/www/vhosts/********.com/
Server    http://www.********.com
Save Path /var/www/vhosts/*********.com/
WS_CAT    /
Write /var/www/vhosts/*********.com/sitemapproducts.xml
Generated Google Product Sitemap Successfully

 

I've seen the issue through these pages but I can't seem the work arounds or advice to change my situation.

 

Any help would be appreciated.

Share this post


Link to post
Share on other sites

Did you change the permissions on the sitemappages file? Did you try using the alternate setting?

Share this post


Link to post
Share on other sites

Jack

 

When testing the cron job I set up the files were not being created. Works fine manually but not via cron.

 

The output from the job was

X-Powered-By: PHP/5.2.17
Content-type: text/html

By displaying the errors

(uiserver):u1:~/sites/shop > php5 /homepages/xxx/googlesitemap/index.php
X-Powered-By: PHP/5.2.17
Content-type: text/html

<br />
<b>Notice</b>:  Use of undefined constant DIR_WS_HTTP_CATALOG - assumed 'DIR_WS_HTTP_CATALOG' in <b>/homepages/xxx/shop/googlesitemap/index.php</b> on line <b>48</b><br />

I changed this to

 

    define('DIR_WS_CATALOG', '/');
 

and now it is crashing out in application top on

  require_once( DIR_FS_CATALOG . 'includes/osc_sec.php' );

Can you think of any reason it would crash in cron but not via a url?

 

Cheers

 

G

 

@@Taipo

Edited by geoffreywalton

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Geoffrey - That is just a waning and won't stop the script from working. Do you still get the map completed messages? If you want to get rid of it, this should work, though I've not tested it:

if (! defined('DIR_WS_HTTP_CATALOG')) define('DIR_WS_HTTP_CATALOG','');

Share this post


Link to post
Share on other sites

 

Via url everything works fine, via CL or cron it crashes on

 

  require_once( DIR_FS_CATALOG . 'includes/osc_sec.php' );

 

Have yet to delve into osc_sec.php.

 

I was looking to only include if calling script is googlesitmap/index.php but would have to move include below the processing

 

// set php_self in the local scope

 

Another gotcha is if you have the word page in your DIR_FS_CATALOG. 1 and 1 use homepages on some of their packages, so this fixed it

 

           if ( preg_match('/ppages/i', $filename) && GOOGLE_XML_SITEMAP_CREATE_PAGES != 'true' ) continue;

 

adding sitemap to every preg_match would probable be better still e.g.

           if ( preg_match('/sitemappages/i', $filename) && GOOGLE_XML_SITEMAP_CREATE_PAGES != 'true' ) continue;

 

Cheers

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

I have both this addon and osc sec installed and they work fine together. Try running it to see that it works. There is a setting in this addons setting that lets you exclude pages so there shouldn't be any reason to change the code for that. But sitemap files shouldn't be excluded in any event.

Share this post


Link to post
Share on other sites

I too have them both installed and they work fine together, it is just when it is run from the command line that it falls over.

 

It must be something to do with the environments the command line and cron run in that cause it to fall over.

 

Cheers

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

It looks like when index.php is run by a cron, osc_sec can not identify the script being run and issues a die command.
 

    function phpSelfFix() {
        if ( false !== ( bool )ini_get( "register_globals" ) || ( ! isset( $HTTP_SERVER_VARS ) ) )
            $HTTP_SERVER_VARS = $_SERVER;
        $filename = null;
        # this is the RC3 standard code
        $filename = ( ( ( strlen( ini_get( "cgi.fix_pathinfo" ) ) > 0 ) && ( ( bool )ini_get( "cgi.fix_pathinfo" ) == false ) ) ||
            ! isset( $HTTP_SERVER_VARS["SCRIPT_NAME"] ) ) ? basename( $HTTP_SERVER_VARS["PHP_SELF"] ) : basename( $HTTP_SERVER_VARS["SCRIPT_NAME"] );
        if ( false === $this->checkfilename( $filename ) ) {
            $filename = null;
        } else
            return $filename;
//die("    1      :<br>");

        # if RC3 fails then try a version of FWR Media's $PHP_SELF code.
        if ( empty( $filename ) && ( false !== strpos( $_SERVER["SCRIPT_NAME"], ".php" ) ) ) {
            preg_match( "@[a-z0-9_]+\.php@i", $_SERVER["SCRIPT_NAME"], $matches );
            if ( is_array( $matches ) && ( array_key_exists( 0, $matches ) ) && ( substr( $matches[0], -4, 4 ) ==
                ".php" ) && ( is_readable( $matches[0] ) || ( false !== strpos( $_SERVER["SCRIPT_NAME"],
                "ext/modules/" ) ) ) ) {
                $filename = $matches[0];
            }
            if ( false === $this->checkfilename( $filename ) ) {
                $filename = null;
            } else
                return $filename;
        }

        # if that fails then try osC_Sec $PHP_SELF code
        if ( empty( $filename ) && false !== $this->issetStrlen( $_SERVER["SCRIPT_FILENAME"] ) ) {
            $tmp = explode( "/", $_SERVER["SCRIPT_FILENAME"] );
            if ( is_array( $tmp ) ) {
                $filename = $tmp[count( $tmp ) - 1];
            }
            if ( false !== $this->checkfilename( $filename ) ) {
                return $filename;
            }
        } elseif ( ( $_SERVER["PHP_SELF"] == "/" ) || ( $_SERVER["SCRIPT_NAME"] == "/" ) ) {
            return "index.php";
        } else {
            die(); // prevent the page from executing
		}
    }

I changed the last line to

die("osc die"); // prevent the page from executing

and the cron job displays

X-Powered-By: PHP/5.2.17
Content-type: text/html

osc die

So I'll add this to the osc_sec support thread.

Cheers

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

It may be that your cron job is not working correctly. I posted this somewhere in this thread, I think, but here is an alternative cron command:

cd /home/USERNAME/public_html/googlesitemap/; /usr/local/bin/php -c /home/USERNAME/public_html/php.ini -q /home/USERNAME/public_html/googlesitemap/index.php 	

You will have to edit it to fit your account, of course.

Share this post


Link to post
Share on other sites

Still no luck on this.

 

I am using

cd /homepages/xxx/googlesitemap/; /usr/local/bin/php5 -c /usr/lib/php.ini -q 
/homepages/xxx/googlesitemap/index.php
When using CL or cron the filename/directory could not be found and it isssued a die command so change osc.php

 

  * END OF SETTINGS
  *****************************/

    if ($_SERVER['PWD'] != '/homepages/xxx/googlesitemap') {
      $osC_Sec = new osC_Sec();
      $osC_Sec->Sentry( $timestampOffset,$nonGETPOSTReqs,$spiderBlock,$banipaddress,$useIPTRAP,
                    $ipTrapBlocked,$emailenabled,$youremail,$fromemail,$disable_tellafriend );
    }
Now Ultimate SEO had problems in application top setting $PHP_SELF. This fixed that:-

 

// set php_self in the local scope

    if ($_SERVER['PWD'] == '/homepages/xxx/googlesitemap') {
      $PHP_SELF = "index.php";
    } else {
      $PHP_SELF = usu5_base_filename();
    }
 With pages turned off everything worked fine except the specials were not generated. Having "homepages" in the directory path caused this, but easily solved.

           if ( preg_match('/sitemapindex/i', $filename) ) continue;
           if ( preg_match('/sitemapmanufacturers/i', $filename) && GOOGLE_XML_SITEMAP_CREATE_MANU != 'true' ) continue;
           if ( preg_match('/sitemappages/i', $filename) && GOOGLE_XML_SITEMAP_CREATE_PAGES != 'true' ) continue;
           if ( preg_match('/sitemapspecials/i', $filename) && GOOGLE_XML_SITEMAP_CREATE_SPECIALS != 'true' ) continue;

Turn on pages and get this error.

 

<b>Catchable fatal error</b>:  Object of class language could not be converted to string in 
<b>/homepages/xxx/googlesitemap/sitemap.class.php</b> on line <b>458</b><br />
 

	function GeneratePagesSitemap(){
		$container = array();
		$changefreq = GOOGLE_SITEMAP_PAGES_CHANGE_FREQ;
		$priority = '.1';

  	include_once(DIR_WS_CLASSES . 'language.php');
	print "Language:\n";
  	$lng = new language();
	print "Language".$lng."\n";

 

Any thoughts

 

Cheers

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

The first error I because of this line

print "Language".$lng."\n";
It is trying to print $lng as text but $lng is an object and that is not allowed. It should be something like
print "Language".$lng->name."\n";

Share this post


Link to post
Share on other sites

The first error I because of this line

print "Language".$lng."\n";
It is trying to print $lng as text but $lng is an object and that is not allowed. It should be something like

print "Language".$lng->name."\n";

Thanks for that, the final problem I had was the isviewable function returned false for everything.

  function IsViewable($file)
  {
    if (($fp = @file($file)))
    {
      for ($idx = 0; $idx < count($fp); ++$idx)
      {
         if (strpos($fp[$idx], "<head>") !== FALSE)
           return true;
      }
    }
    return false;
  }

Fast and nasty fix is to change return false; to true, but will investigate further.

 

Cheers

 

G

 


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

That code is for a pre-2.3 shop. If this is a 2.3 version, you should not be seeing that code. In the googlesitemap/index.php file, there is code to determine which version is being used so that is where you should look first.

Share this post


Link to post
Share on other sites

I think there is an small error here

if (GOOGLE_XML_SITEMAP_CREATE_MANU == 'true') {
  $showManufacturers = true;
  if ($google->GenerateManufacturerSitemap()){
        $showManufacturers = true;
  	echo 'Generated Google Manufacturers Sitemap Successfully' . "\n\n";
  } else {
    $manufacturers_query = tep_db_query("select manufacturers_id from " . TABLE_MANUFACTURERS . " limit 1");
    if (tep_db_num_rows($manufacturers_query) > 0) {
        $submit = false;
        echo 'ERROR: Google Manufacturers Sitemap Generation FAILED!' . "\n\n";
    } else {
        echo 'Google Sitemap Manufacturers not generated - no Manufacturers found!' . "\n\n";
    }
  }
}

notice the following which appears twice

$showManufacturers = true;
Edited by mommaroodles

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

Share this post


Link to post
Share on other sites

Yes, you are correct. The first one should be removed. Thank you for mentioning it.

Share this post


Link to post
Share on other sites

this is what I did to my  googlesitemap/index.php file and everything is working fine for me with no errors.

<?php
/**
 * Google XML Sitemap Feed Cron Script
 *
 * The Google sitemap service was announced on 2 June 2005 and represents
 * a huge development in terms of crawler technology.  This contribution is
 * designed to create the sitemap XML feed per the specification delineated 
 * by Google.  This cron script will call the code to create the scripts and 
 * eliminate the session auto start issues. 
 * @package Google-XML-Sitemap-Feed
 * @[member=licensed2kill] http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version 1.2
 * @[member=Link] http://www.oscommerce-freelancers.com/ osCommerce-Freelancers
 * @[member=Link] http://www.google.com/webmasters/sitemaps/docs/en/about.html About Google Sitemap 
 * @[member=copyright] Copyright 2005, Bobby Easland 
 * @[member=author] Bobby Easland 
 * @filesource
 */

	chdir('../');
	/**
	 * Option to compress the files
	 */
	define('GOOGLE_SITEMAP_COMPRESS', 'false');
	/**
	 * Option for change frequency of products
	 */
	define('GOOGLE_SITEMAP_PROD_CHANGE_FREQ', 'weekly');
	/**
	 * Option for change frequency of categories
	 */
	define('GOOGLE_SITEMAP_CAT_CHANGE_FREQ', 'weekly');
	/**
	 * Carried over from application_top.php for compatibility
	 */
	define('GOOGLE_SITEMAP_MAN_CHANGE_FREQ', 'weekly');
	/**
	 * Carried over from application_top.php for compatibility
	 */
	define('GOOGLE_SITEMAP_SPECIALS_CHANGE_FREQ', 'weekly');
	/**
	 * Carried over from application_top.php for compatibility
	 */
        define('GOOGLE_SITEMAP_PAGES_CHANGE_FREQ', 'weekly'); 
        define('GOOGLE_SITEMAP_TOPICS_CHANGE_FREQ', 'weekly');
	//define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);

	require_once('includes/application_top.php');
/*
	require_once(DIR_WS_INCLUDES . 'filenames.php');
	require_once(DIR_WS_INCLUDES . 'database_tables.php');
	require_once(DIR_WS_FUNCTIONS . 'database.php');
	tep_db_connect() or die('Unable to connect to database server!');*/


/*
	$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
	while ($configuration = tep_db_fetch_array($configuration_query)) {
		define($configuration['cfgKey'], $configuration['cfgValue']);
	}*/


/*
	function tep_not_null($value) {
		if (is_array($value)) {
		  if (sizeof($value) > 0) {
			return true;
		  } else {
			return false;
		  }
		} else {
		  if (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) {
			return true;
		  } else {
			return false;
		  }
		}
	} # end function

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


if ( defined('SEO_URLS') && SEO_URLS == 'true' || defined('SEO_ENABLED') && SEO_ENABLED == 'true' ) {
/*

	function tep_session_is_registered( $var ){
		return false;
	}  # end function

	function tep_session_name(){
		return false;
	} # end function
	
	function tep_session_id(){
		return false;
	} # end function

	function tep_parse_input_field_data($data, $parse) {
		return strtr(trim($data), $parse);
	} # end function

	function tep_output_string($string, $translate = false, $protected = false) {
		if ($protected == true) {
		  return htmlspecialchars($string);
		} else {
		  if ($translate == false) {
			return tep_parse_input_field_data($string, array('"' => '"'));
		  } else {
			return tep_parse_input_field_data($string, $translate);
		  }
		}
	} # end function

	
	if ( file_exists(DIR_WS_CLASSES . 'seo.class.php') ){
    if (! defined("tep_get_parent_categories"))
    {
      function tep_get_parent_categories(&$categories, $categories_id) {
        $parent_categories_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$categories_id . "'");
        while ($parent_categories = tep_db_fetch_array($parent_categories_query)) {
          if ($parent_categories['parent_id'] == 0) return true;
          $categories[sizeof($categories)] = $parent_categories['parent_id'];
          if ($parent_categories['parent_id'] != $categories_id) {
            tep_get_parent_categories($categories, $parent_categories['parent_id']);
          }
        }
      }
    }*/

		require_once(DIR_WS_CLASSES . 'seo.class.php');
		$seo_urls = new SEO_URL($languages_id);
/*
	}

	require_once(DIR_WS_FUNCTIONS . 'html_output.php');
	
	if ( file_exists(DIR_WS_CLASSES . 'cache.class.php') ){
		include(DIR_WS_CLASSES . 'cache.class.php');
		$cache = new cache($languages_id);
		if ( file_exists('includes/seo_cache.php') ){
			include('includes/seo_cache.php');
		}
		$cache->get_cache('GLOBAL');
	}*/

} # end if

error_reporting(0);
$mapfile = ((GOOGLE_XML_SITEMAP_SEO != 'Standard') ? 'sitemap.class_Alternate.php' : 'sitemap.class.php');
require_once('googlesitemap/' . $mapfile);

$file = file_get_contents('includes/application_top.php');
$version = "<head>";
if (strpos($file, 'v2.3') !== FALSE) {
  $version = "template_top.php";
}

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

$showManufacturers = false;
$showPages = false;
$showSpecials = false;
$showTopics = false;
$submit = true;

echo '<pre>';
if ($google->GenerateProductSitemap()){
	echo 'Generated Google Product Sitemap Successfully' . "\n\n";
} else {
	$submit = false;
	echo 'ERROR: Google Product Sitemap Generation FAILED!' . "\n\n";
}

if ($google->GenerateCategorySitemap()){
	echo 'Generated Google Category Sitemap Successfully' . "\n\n";
} else {
	$submit = false;
	echo 'ERROR: Google Category Sitemap Generation FAILED!' . "\n\n";
}

if (GOOGLE_XML_SITEMAP_CREATE_MANU == 'true') {
  $showManufacturers = true;
  if ($google->GenerateManufacturerSitemap()){
        $showManufacturers = true;
  	echo 'Generated Google Manufacturers Sitemap Successfully' . "\n\n";
  } else {
    $manufacturers_query = tep_db_query("select manufacturers_id from " . TABLE_MANUFACTURERS . " limit 1");
    if (tep_db_num_rows($manufacturers_query) > 0) {
        $submit = false;
        echo 'ERROR: Google Manufacturers Sitemap Generation FAILED!' . "\n\n";
    } else {
        echo 'Google Sitemap Manufacturers not generated - no Manufacturers found!' . "\n\n";
    }
  }
}

if (GOOGLE_XML_SITEMAP_CREATE_PAGES == 'true') {
  if ($google->GeneratePagesSitemap()){
      $showPages = true;
      echo 'Generated Google Pages Sitemap Successfully' . "\n\n";
  } else {
      $submit = false;
      echo 'ERROR: Google Pages Sitemap Generation FAILED!' . "\n\n";
  }
}

if (GOOGLE_XML_SITEMAP_CREATE_SPECIALS == 'true') {
  if ($google->GenerateSpecialsSitemap($languages_id)){
        $showSpecials = true;
  	echo 'Generated Google Specials Sitemap Successfully' . "\n\n";
  } else {
    $specials_query = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' limit 1");
    if (tep_db_num_rows($specials_query) > 0) {
  	  $submit = false;
  	  echo 'ERROR: Google Specials Sitemap Generation FAILED!' . "\n\n";
    } else {
  	  echo 'Google Sitemap Specials not generated - no specials found!' . "\n\n";
    }
  }
}

if (GOOGLE_XML_SITEMAP_CREATE_TOPICS == 'true') {
  if ($google->GenerateTopicsSitemap($languages_id)){
        $showTopics = true;
  	echo 'Generated Google Topics Sitemap Successfully' . "\n\n";
  } else {
  	$submit = false;
  	echo 'ERROR: Google Topics Sitemap Generation FAILED!' . "\n\n";
  }
}

if ($google->GenerateSitemapIndex()){
	echo 'Generated Google Sitemap Index Successfully' . "\n\n";
} else {
	$submit = false;
	echo 'ERROR: Google Sitemap Index Generation FAILED!' . "\n\n";
}


if ($submit){
	echo 'CONGRATULATIONS! All files generated successfully.' . "\n\n";
	echo 'If you have not already submitted the sitemap index to Google click the link below.' . "\n";
	echo 'Before you do I HIGHLY recommend that you view the XML files to make sure the data is correct.' . "\n\n";
	echo $google->GenerateSubmitURL() . "\n\n";
	echo 'For your convenience here is the CRON command for your site:' . "\n";
	echo 'php ' . dirname($_SERVER['SCRIPT_FILENAME']) . '/index.php' . "\n\n";
	echo 'Here is your sitemap index: ' . $google->base_url . 'sitemapindex.xml' . "\n";
	echo 'Here is your product sitemap: ' . $google->base_url . 'sitemapproducts.xml' . "\n";
	echo 'Here is your category sitemap: ' . $google->base_url . 'sitemapcategories.xml' . "\n";

        if (GOOGLE_XML_SITEMAP_CREATE_MANU == 'true' && $showManufacturers)
          echo 'Here is your manufacturers sitemap: ' . $google->base_url . 'sitemapmanufacturers.xml' . "\n";

        if (GOOGLE_XML_SITEMAP_CREATE_PAGES == 'true')
          echo 'Here is your pages sitemap: ' . $google->base_url . 'sitemappages.xml' . "\n";

        if (GOOGLE_XML_SITEMAP_CREATE_SPECIALS == 'true' && $showSpecials)
          echo 'Here is your specials sitemap: ' . $google->base_url . 'sitemapspecials.xml' . "\n";

        if (GOOGLE_XML_SITEMAP_CREATE_TOPICS == 'true' && $showTopics)
          echo 'Here is your topics sitemap: ' . $google->base_url . 'sitemaptopics.xml' . "\n";
} else {
	print_r($google->debug);
}


echo '</pre>';
?>

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

Share this post


Link to post
Share on other sites

My only problem now is the links on the xml files are not the seo links! :wacko: still showing up as product_info.php?products_id=3783  instead of  *.html

 

is working :)

Edited by mommaroodles

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

Share this post


Link to post
Share on other sites

also just want to mention - its better to use this

    if (!function_exists("tep_get_parent_categories")) {
      function tep_get_parent_categories(&$categories, $categories_id) {
        $parent_categories_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$categories_id . "'");
        while ($parent_categories = tep_db_fetch_array($parent_categories_query)) {
          if ($parent_categories['parent_id'] == 0) return true;
          $categories[sizeof($categories)] = $parent_categories['parent_id'];
          if ($parent_categories['parent_id'] != $categories_id) {
            tep_get_parent_categories($categories, $parent_categories['parent_id']);
          }
        }
      }
    }

instead of this

    if (!defined("tep_get_parent_categories")) {
      function tep_get_parent_categories(&$categories, $categories_id) {
        $parent_categories_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$categories_id . "'");
        while ($parent_categories = tep_db_fetch_array($parent_categories_query)) {
          if ($parent_categories['parent_id'] == 0) return true;
          $categories[sizeof($categories)] = $parent_categories['parent_id'];
          if ($parent_categories['parent_id'] != $categories_id) {
            tep_get_parent_categories($categories, $parent_categories['parent_id']);
          }
        }
      }
    }

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

Share this post


Link to post
Share on other sites

Heres just a little hint aswell

 

instead of using

for ($i = 0; $i < count($pages); ++$i) {...}

use

$size = count($pages); for($i=0; $i<$size;$i++){…}

The first method will call count function on each iteration of for loop, while in second iteration count function is being called only once.


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

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

×