Sitemap Creator 1.5 SEO ON

```php
//=======================================================================

// File: GOOGLE_SITEMAP.PHP

// Description: Google Sitemap Generator.

// Created: 2006-10-12

// Ver: $Id: google_sitemap.php 2 2006-10-12 00:0:00Z lsb $

//

// Copyright 2006 (c) RENS Management, LLC. All rights reserved.

//========================================================================



if ( !defined(‘IN_CSCART’) ) { die(‘Access denied’); }



$products=$categories=array();

$categories_all=db_get_array(“SELECT category_id FROM $db_tables[categories] WHERE membership_id=0 && avail=‘Y’”);

$products_all=db_get_array(“SELECT product_id FROM $db_tables[products] WHERE avail=‘Y’”);

while (list(, $cats) = each($categories_all)) $categories[]=$cats[‘category_id’];

while (list(, $items) = each($products_all)) $products[]=$items[‘product_id’];

header(“Content-Type: text/xml;charset=utf-8”);

$lastmod = date(“Y-m-d”, time());

$siteurl = utf8_encode(htmlentities(“$http_location”));

echo <<






$siteurl

$lastmod

daily

1.0

\n

START;



// process categories

foreach ($categories as $category) {

$link = utf8_encode(htmlentities(“$http_location/$index_script?$target_name=categories&category_id=$category”));

fn_convert_php_urls($link);

echo <<


$siteurl/$link

$lastmod

daily

0.5

\n

LINKS;

}



// process products

foreach ($products as $product) {

$link = utf8_encode(htmlentities(“$http_location/$index_script?$target_name=products&product_id=$product”));

fn_convert_php_urls($link);

echo <<


$siteurl/$link

$lastmod

daily

0.5

\n

LINKS;

}



echo <<




END;

exit;

?> ```









all mistakes fixed.

Hi Honey,



You’ld be better off adding these brackets around the coding [*code] and [/*code] (Remove the * from each) as this will preserve the text formatting and removes smiley’s from appearing in the text.



Regardless,

Thank You for your contribution



PS: 1.3.5 should be mentioned in your title?

O.K. I guess I 'll be the one to ask.



What does this do and what would you do with it?



Sorry for not knowing.



Brandon

[quote name=‘brandonvd’]O.K. I guess I 'll be the one to ask.



What does this do and what would you do with it?



Sorry for not knowing.



Brandon[/QUOTE]



Brandon… this is further to this thread.



You will install the script and then configure the link Google sitemap account. Details on google sitemap link



The only problem with above script is that it doen’t works… looks here is the issue




This script works perfect.i use that on my site(www.eniyial.com/index.php?target=google_sitemap)

and its valid on google.



you can test there:



[url]Validate XML Sitemap - XML Sitemaps Generator

honey2000, please edit the top post and place that code inside PHP or CODE tags. This will fix the

[quote name=‘S-Combs’]honey2000, please edit the top post and place that code inside PHP or CODE tags. This will fix the
Done - Updated for the benefit of all

JesseLeeStringer



Could you please post a step by step to get my sitemap onto Google? I have downloaded your gym_sitemap and followed the directions and when I click on sitemap on my site it shows error no page found and i too get those errors mentioned by other members when validating.

The info is incorrect now that it has been edited. honey will need to repost that line.

so far I’ve been unable to get this working, using Sculpting Studio’s modification with this coding update to no avail

Has anyone been able to get this Sitemap Generataor to work with version 1.3.5 I have tried multiple times with no luck. My site returns a “Error: Unfortunately we cannot locate this page for you.” Before my upgrade to 1.3.5 this map generator worked fine. Would love to get it working again…

[quote name=‘architeach’]Has anyone been able to get this Sitemap Generataor to work with version 1.3.5 I have tried multiple times with no luck. My site returns a “Error: Unfortunately we cannot locate this page for you.” Before my upgrade to 1.3.5 this map generator worked fine. Would love to get it working again…[/QUOTE]



I did some comparisons to the existing codes in the “targets” directory to the ones that have been pasted to this forum entry and there were some difference in the code that needed to be adjusted. I have never done any serious coding so I am very proud of myself for figuring this out. Plus, I am excited to finally be able to give back the forum after all of you have helped me out so much.



After making the changes, the sitemap generator actually works and I am running version 1.3.5 sp1.



I have SEO enabled with the “Product SEO type” set to “product_name.html”



In the CONFIG.php below this line:

```php ‘logs’ => TARGETS_DIR . ‘logs.php’, ```

add this line:

```php ‘google_sitemap’ => TARGETS_DIR . ‘google_sitemap.php’, ```



In the TARGETS directory add a file name “google_sitemap.php” with this code"

```php //=======================================================================
// File: GOOGLE_SITEMAP.PHP
// Description: Google Sitemap Dispatcher.
// Created: 2006-10-12
// Ver: $Id: google_sitemap.php 1 2006-10-12 00:0:00Z lsb $
//
// Copyright 2006 (c) RENS Management, LLC. All rights reserved.
//========================================================================

if ( !defined('IN_CSCART') ) { die('Access denied'); }

if (AREA == 'C') {

include CUSTOMER_DIR . 'google_sitemap.php';

} elseif (AREA == 'A') {

include ADMIN_DIR . 'google_sitemap.php';

}

?> ```



And the final step is to create another file named google_sitemap.php with this code:

```php
//=======================================================================

// File: GOOGLE_SITEMAP.PHP

// Description: Google Sitemap Generator.

// Created: 2006-10-12

// Ver: $Id: google_sitemap.php 2 2006-10-12 00:0:00Z lsb $

//

// Copyright 2006 (c) RENS Management, LLC. All rights reserved.

//========================================================================



if ( !defined(‘IN_CSCART’) ) { die(‘Access denied’); }



$products=$categories=array();

$categories_all=db_get_array(“SELECT category_id FROM $db_tables[categories] WHERE membership_id=0 && avail=‘Y’”);

$products_all=db_get_array(“SELECT product_id FROM $db_tables[products] WHERE avail=‘Y’”);

while (list(, $cats) = each($categories_all)) $categories[]=$cats[‘category_id’];

while (list(, $items) = each($products_all)) $products[]=$items[‘product_id’];

header(“Content-Type: text/xml;charset=utf-8”);

$lastmod = date(“Y-m-d”, time());

$siteurl = utf8_encode(htmlentities(“$http_location”));

echo <<






$siteurl

$lastmod

daily

1.0

\n

START;



// process categories

foreach ($categories as $category) {

$link = utf8_encode(htmlentities(“$http_location/$index_script?$target_name=categories&category_id=$category”));

fn_convert_php_urls($link);

echo <<


$siteurl/$link

$lastmod

daily

0.5

\n

LINKS;

}



// process products

foreach ($products as $product) {

$link = utf8_encode(htmlentities(“$http_location/$index_script?$target_name=products&product_id=$product”));

fn_convert_php_urls($link);

echo <<


$siteurl/$link

$lastmod

daily

0.5

\n

LINKS;

}



echo <<




END;

exit;

?> ```



Place a copy of this file in both the include/admin and the include/customer directories.



Good luck!

Thanks architeach for pulling it all together. I got it to work just fine, except that it includes categories and products that I had marked unavailable.



I don’t have time to modify the code to skip unavailable categories, but if someone does, please post!



Thanks,

Fred



P.S. You can validate your Google sitemap here:



[url]http://www.validome.org/google/[/url]

might be being particularly stupid but, what does this generate and where does it generate it to?



Barryh

I got the following error:



Fatal error: Call to undefined function fn_convert_php_urls() in /[COLOR=red]…[/COLOR]/include/customer/google_sitemap.php on line 35



I edited out the part in [COLOR=red]red[/COLOR]

I installed this mod a couple of weeks ago and it works fine, I can only suggest that you may have missed something?



Sorry can’t be more helpful.



Barry

I tried this 3 times, but got the same error:



Parse error: syntax error, unexpected T_SL, expecting ‘,’ or ‘;’ in mysite…/include/customer/google_sitemap.php on line 21



Any ideas how to fix this?

Ok, I got it to work after using the code Honey2000 posted here : [url]http://forum.cs-cart.com/showthread.php?t=1179&page=6[/url]

HI thanks for your effort

I tried Non Seo Version and that workd fine.now I simply replaced google_sitemap.php

(generator) from the previous version with this one.

it seems to work.but there is one problem.

links in my sitemap should be something like this :

http://learnguide.net/harry-potter-and-the-philosophers-stone-p2370.html



but they are now in this format :


http://learnguide.net/http://learnguide.net/harry-potter-and-the-philosophers-stone-p2370.html



you see first http://learnguide.net/ should be ommited.

any suggestion?

thanks in advance

Hi Medhi, From what you are explaining, it sounds like your code is this:



```php $siteurl/$siteurl/$link ```



It should be:



```php $siteurl/$link ```



If it is like the second code, I am not sure what is going on? Try this code then:



```php $link ```