Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Google Sitemap Generator Rate Topic   - - - - -

 

Posted 12 October 2006 - 07:17 AM #1

This mod will generate a well formed XML sitemap for Google in three easy steps.

1. Edit your config.php file. If it is best to download config.php from your server and modify it on your workstation so you know you have the correct and latest file. Towards the bottom of the page, you will find this code:
'logs' => $targets_dir.'logs.php',
);

Make it look like this and upload to your server. I assume you know how to FTP.
'logs' => $targets_dir.'logs.php',
'google_sitemap' => $targets_dir.'google_sitemap.php',
);


2. Copy the code below and make a new file called "google_sitemap.php". I know, how do I create the file? After you copied the code below, open notepad and select "paste" or hit the keys "ctrl" "v" and the sametime. In notepad, click on "File" and choose "save as" and give it the name "google_sitemap.php". It needs to be placed in the folder called "targets" on your server.

<?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';

}

?>


3. Now we are going to do the same Copy and Past as before. We are even going to use the same file name "google_sitemap.php", but inside it is different. Copy the code below and paste it into a new file called "google_sitemap.php". Now the file will be FTP to two locations on your server. The first is the folder include/customer and the second folder is include/admin.

<?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 <<<START
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>$siteurl</loc>
<lastmod>$lastmod</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>\n
START;

// process categories
foreach ($categories as $category) {
$link = utf8_encode(htmlentities("$http_location/$index_script?$target_name=categories&category_id=$category"));
echo <<<LINKS
<url>
<loc>$link</loc>
<lastmod>$lastmod</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>\n
LINKS;
}

// process products
foreach ($products as $product) {
$link = utf8_encode(htmlentities("$http_location/$index_script?$target_name=products&product_id=$product"));
echo <<<LINKS
<url>
<loc>$link</loc>
<lastmod>$lastmod</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>\n
LINKS;
}

echo <<<END

</urlset>
END;
exit;
?>


Once installed, goto this site and enter the URL to your new sitemap generator. The URL on your site should looks something like this:


[noparse]http://www.mycart.com/index.php?target=google_sitemap[/noparse]
[noparse]http://www.mycart.com/shop/index.php?target=google_sitemap[/noparse]

If everything is working to this point, the next message will show you how to tell Google to use your new sitemap generator.

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 

Posted 12 October 2006 - 07:19 AM #2

If everything is work to this point, the next message will show you how to tell Google to use your new sitemap generator. Once installed, goto Google:

https://www.google.c...iew?hl=en&hl=en

If you are running an e-commerce site, you should all ready have an account, it not, now is the time to start getting more traffic to your site.

You will see a box called "Add Site". Enter your site now and click "OK". Now you will see the Summary. Notice is says "Verify your ownership". You need to do this right now. See the gray box a little further down? The one that says "Next Step"? Ok, I want you to click the link "Verify your site". On the next page the drop down box says "Choose verification method...". Pick "Add a META tag". Still with me? Ok, copy the Meta tag being displayed in bold print. Copy everything from < to >. Now you need to edit a file in your shopping cart to put this meta tag into. I want you to find the file this file called meta.tpl and it should be located at skins/yourskin/customer/meta.tpl. Go to the bottom and add the Google Meta Tag.

Once you have uploaded meta.tpl, you can go back to the Google webpage and click the button "Verify". Now your site should be verified by Google, if not, don't call me. For the rest of you, you will notice a little yellow alert message that just happens to have a link called "Submit a Sitemap". Click it ! See the dropdown "Choose type..."? "Choose Add General Web Sitemap" and in box number 3 enter your URL where the sitemap is located. The URL should look like one of these:

[noparse]http://www.mycart.com/index.php?target=google_sitemap[/noparse]
[noparse]http://www.mycart.com/shop/index.php?target=google_sitemap[/noparse]

Then click the button "Add Web Sitemap". Now you can see status and find out when your site was indexed. Cool uh?

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 

Posted 12 October 2006 - 08:15 AM #3

sculptingstudio,

I appreciate this more then you'll ever know,
google has a tendandcy to kick my website off the server unless I update the sitemap everyfew days.

Problem Solved!

 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 12 October 2006 - 12:46 PM #4

Empty Sitemap
Your Sitemap does not contain any URLs. Please validate and resubmit your Sitemap
CS-Cart 3.0.3

 

Posted 12 October 2006 - 02:31 PM #5

Empty Sitemap
Your Sitemap does not contain any URLs. Please validate and resubmit your Sitemap

Check your steps again:

1. place the new target in config.php.
2. google sitemap dispatcher in targets/google_sitemap.php
3. google sitemap generator in include/customer/google_sitemap.php and include/admin/google_sitemap.php
4. google meta tag added to skins/yourskin/customer/meta.tpl
5. submit link http://www.yourcart....=google_sitemap

If you want to see the code run, here is my link to the google sitemap:

http://www.sculpting...=google_sitemap

If you place the link above in firefox, you will see the xml displayed.

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 
  • taydu
  • Senior Member
  • Members
  • Join Date: 24-Jul 06
  • 350 posts

Posted 12 October 2006 - 04:21 PM #6

thanks a lot, i will try this later

 
  • TonyK
  • Member
  • Members
  • Join Date: 03-Mar 06
  • 1686 posts

Posted 12 October 2006 - 06:01 PM #7

Next step maybe to output the site map using SEO if SEO is turned on.
Pimpin' skins since v1.0

 

Posted 12 October 2006 - 06:09 PM #8

Next step maybe to output the site map using SEO if SEO is turned on.

Once 1.3.4 is released, this mod can be updated also. It would be a simple matter to fetch the category/product name and formatting the link.

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 13 October 2006 - 12:20 AM #9

Schema validating with XSV 2.10-1 of 2005/04/22 13:10:49
Schema validator crashed
The maintainers of XSV will be notified, you don't need to send mail about this unless you have extra information to provide. If there are Schema errors reported below, try correcting them and re-running the validation.

Target:

Last Modified: Fri, 13 Oct 2006 00:19:43 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.3 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a)
The target was not assessed

--------------------------------------------------------------------------------

Low-level XML well-formedness and/or validity processing output
CS-Cart 3.0.3

 

Posted 13 October 2006 - 03:44 AM #10

Schema validator crashed
http://www.indymart....=google_sitemap

When I enter your url, I don't see any output. That would explain the validator crash, nothing to valid.

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 13 October 2006 - 03:49 AM #11

When I enter your url, I don't see any output. That would explain the validator crash, nothing to valid.


I understand that, but was installed exactly per your instractions, and no result, just blank page:
CS-Cart 3.0.3

 

Posted 13 October 2006 - 03:01 PM #12

so what to do?

Any errors in your errorlog? Also, if you have memberships set to something other than all, you might try entering the appropriate number of just remove this from the query in google_sitemap.php: membership_id=0

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 13 October 2006 - 09:58 PM #13

Any errors in your errorlog? Also, if you have memberships set to something other than all, you might try entering the appropriate number of just remove this from the query in google_sitemap.php: membership_id=0


I was remove membership_id=0 but no luck?
CS-Cart 3.0.3

 

Posted 13 October 2006 - 10:09 PM #14

I was remove membership_id=0 but no luck?

Check the Errorlog to see what is happening.

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 13 October 2006 - 10:20 PM #15

No errors related to google site map
CS-Cart 3.0.3

 

Posted 14 October 2006 - 12:06 AM #16

No errors related to google site map

I just looked at your http response header. My code isn't being executed. Check the $script_targets to make sure google_sitemap is included and the php files are in the correct folders. In index.php the code that includes the file is:

//
// Include target script from $script_targets array
//
if (file_exists(@$script_targets[$target])) {
include $script_targets[$target];
} else {
fn_set_exception('no_page');
}


If you change include to require, it will produce an error if the target isn't found:
//
// Include target script from $script_targets array
//
if (file_exists(@$script_targets[$target])) {
require $script_targets[$target];
} else {
fn_set_exception('no_page');
}

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 14 October 2006 - 12:48 AM #17

I just looked at your http response header. My code isn't being executed. Check the $script_targets to make sure google_sitemap is included and the php files are in the correct folders. In index.php the code that includes the file is:

//
// Include target script from $script_targets array
//
if (file_exists(@$script_targets[$target])) {
include $script_targets[$target];
} else {
fn_set_exception('no_page');
}


If you change include to require, it will produce an error if the target isn't found:
//
// Include target script from $script_targets array
//
if (file_exists(@$script_targets[$target])) {
require $script_targets[$target];
} else {
fn_set_exception('no_page');
}


This is my index.php file no changes:

<?php
/******************************************************************************
* *
* Copyright © 2004-2005 CS-Cart.com. All rights reserved. *
* *
*******************************************************************************
* *
* CS-Cart is commercial software, only users who have purchased a valid *
* license through https://www.cs-cart.com/ and accept to the terms of this *
* License Agreement can install this product. *
* *
*******************************************************************************
* THIS CS-CART SHOP END-USER LICENSE AGREEMENT IS A LEGAL AGREEMENT BETWEEN *
* YOU AND YOUR COMPANY (COLLECTIVELY, "YOU") AND CS-CART.COM (HEREINAFTER *
* REFERRED TO AS "THE AUTHOR") FOR THE SOFTWARE PRODUCT IDENTIFIED ABOVE, *
* WHICH INCLUDES COMPUTER SOFTWARE AND MAY INCLUDE ASSOCIATED MEDIA, PRINTED *
* MATERIALS, AND "ONLINE" OR ELECTRONIC DOCUMENTATION (COLLECTIVELY, THE *
* "SOFTWARE"). BY USING THE SOFTWARE, YOU SIGNIFY YOUR AGREEMENT TO ALL *
* TERMS, CONDITIONS, AND NOTICES CONTAINED OR REFERENCED HEREIN. IF YOU ARE *
* NOT WILLING TO BE BOUND BY THIS AGREEMENT, DO NOT INSTALL OR USE THE *
* SOFTWARE. *
* *
* PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" *
* FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE *
* AT THE FOLLOWING URL: https://www.cs-cart.com/license.html *
******************************************************************************/

//
// $Id: index.php 1609 2006-04-28 13:00:38Z zeke $
//

//error_reporting(E_ALL);

DEFINE ('AREA', 'C');
DEFINE ('AREA_NAME' ,'customer');

require './prepare.php';
if (!empty($html_catalog)) {
define ('NO_SESSION', true);
}
require './init.php';

if (!empty($settings['General']['store_access_key'])) {
sess_register('store_access_key');
if (!empty($_GET['store_access_key'])) {
$store_access_key = $_GET['store_access_key'];
}
if ($store_access_key != $settings['General']['store_access_key']) {
fn_redirect('store_closed.html');
}
}
// Converting script vars to use in HTML catalog
if (!empty($html_catalog)) {
$index_script = $cscart_host_dir . '/' . $customer_index;
$image_index = $cscart_host_dir . '/' . $image_index;
// Disable ajax pagination during html catalog generation
$settings['Appearance']['customer_ajax_based_pagination'] = 'N';
$smarty->assign('image_index', $image_index);
} else {
$index_script = $customer_index;
}

//
// Common includes
//
include $common_dir.'customer_common.php';

//

// fn_add_breadcrumb(fn_get_lang_var('home'), $index_script);

//
if (empty($target)) {
$target = 'index';
}

//
// Include target script from $script_targets array
//
if (file_exists(@$script_targets[$target])) {
include $script_targets[$target];
} else {
fn_set_exception('no_page');
}

$smarty->assign('index_script', $index_script);

fn_show_template('index.tpl',$smarty, true);
?>

---------------------------------------------

public_html/targets/google_sitemap.php
public_html/include/admin/google_sitemap.php
public_html/include/customer/google_sitemap.php
CS-Cart 3.0.3

 

Posted 14 October 2006 - 01:39 AM #18

This is my index.php file no changes

public_html/targets/google_sitemap.php
public_html/include/admin/google_sitemap.php
public_html/include/customer/google_sitemap.php


Assuming the path is correct, this is what is in each file from my first post in this thread.

public_html/config.php should have the code added from section 1.
public_html/targets/google_sitemap.php should have the code from section 2.
public_html/include/admin/google_sitemap.php should have the code from section 3.
public_html/include/customer/google_sitemap.php should have the code from section 3.

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx


 
  • dominos_2004
  • Senior Member
  • Members
  • Join Date: 02-Jan 06
  • 257 posts

Posted 14 October 2006 - 01:52 AM #19

Assuming the path is correct, this is what is in each file from my first post in this thread.

public_html/config.php should have the code added from section 1.
public_html/targets/google_sitemap.php should have the code from section 2.
public_html/include/admin/google_sitemap.php should have the code from section 3.
public_html/include/customer/google_sitemap.php should have the code from section 3.


Exactly per your instraction.

But not work!
CS-Cart 3.0.3

 

Posted 14 October 2006 - 02:10 AM #20

Exactly per your instraction.

But not work!

Without an error, I can't go any further.

Larry
SculptingStudio.com
DigitalOcean VM

Ubuntu 14.04

Nginx