Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dynamic SiteMap


Jack_mcs

Recommended Posts

You're welcome. Actually, I had put a check in the code to make sure it only read php files but didn't think about the .php_orig type (which I use too). So I have uploaded a new version that will check for that. The only file changed is the modules/dynamic_sitemap.php file so that can just be copied over to install the update.

 

Jack

 

Nice ! Just updated to your last changes and no more non-php extension files are bugging the sitemap :thumbsup:

 

One idea/enhancement I like to drop for which I don't know how difficult it will be or how wanted.

It's purely about multilanguage shops like mine; as all file names are english they show up in english within the site map and for that also in rather cryptic way for probably most customers (like ie. about_us which is not the best example but you understand what I mean). What if the contrib would look for an equivalent file name within the language directory and if found pick the NAVBAR_TITLE or HEADING_TITLE which would then be displayed instead of the raw file name ?

That would make it DSS (Dynamic Super Sitemap) :D

Link to comment
Share on other sites

That's a good idea and it shouldn't be too hard to change. Just to clarify though, are the links of the infoboxes showing up in the proper language? The code should read in the proper language file and load the correct text for those.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

That's a good idea and it shouldn't be too hard to change. Just to clarify though, are the links of the infoboxes showing up in the proper language? The code should read in the proper language file and load the correct text for those.

 

Jack

 

Jack,

 

Yes, the links of the infoboxes are in the correct language. It's just the seperate files which reflect the raw (english) file name.

 

Howard

Link to comment
Share on other sites

Jack,

I am still learning about SEO and the whole spider/robot methodology, so forgive my ignorance. Since this sitemap is "dynamic" will it still have the positive SEO effects of a static sitemap? Will spiders still hit the sitemap and use it to hit all other links?

 

Thanks in advance!

 

Regards,

Siddall

Link to comment
Share on other sites

Jack,

 

The right column has my product categories and looks great!

 

The left column looks like this:

 

*Account 
*Account_edit 
*Account_history 
*Account_history_info 
*Account_newsletters 
*Account_notifications 
*Account_password 
*Address_book 
*Address_book_process 
*Advanced_search 
*Checkout_confirmation 
*Checkout_payment 
*Checkout_payment_address 
*Checkout_shipping 
*Checkout_shipping_address 
*Checkout_success 
*Conditions 
*Contact_us 
*Contest 
*Contest_rules 
*Cookie_usage 
*Create_account 
*Custom 
*Custom_rules 
*Index 
*Info_shopping_cart 
*Login 
*Logoff 
*Password_forgotten 
*Privacy 
*Product_reviews 
*Products_new 
*Product_reviews_info 
*Product_reviews_write 
*Reviews 
*Shipping 
*Shopping_cart 
*Specials 
*Ssl_check 
*Tell_a_friend 
*Dynamic_sitemap

*Information 
    o Shipping & Returns 
    o Privacy Notice 
    o Conditions of Use 
    o Contact Us 
    o Site Map

 

Is that list of filenames with the underscores correct?

The information infobox at the end looks good...and appears to use the filenames form filenames.php. Whereas, the long list is not.

 

Do you have any advice?

 

I also have an infobox that is basically a ripe from "Contact Us" and it choked on it...I had to exclude it. Even odder, I have a third infobox that is a ripe from "Contact Us" and almost identical to the one that chokes but it worked fine. That issue is melting my brain!

 

Thanks in advance!

Siddall

Link to comment
Share on other sites

Jack,

  I am still learning about SEO and the whole spider/robot methodology, so forgive my ignorance.  Since this sitemap is "dynamic" will it still have the positive SEO effects of a static sitemap?  Will spiders still hit the sitemap and use it to hit all other links? 

 

Thanks in advance!

 

Regards,

Siddall

The difference between this contribution and the static one, is that this one will add more links to the page, thus increasing the number of links the SE will see.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Jack,

 

The right column has my product categories and looks great!

 

The left column looks like this:

 

*Account 
*Account_edit 
*Account_history 
*Account_history_info 
*Account_newsletters 
*Account_notifications 
*Account_password 
*Address_book 
*Address_book_process 
*Advanced_search 
*Checkout_confirmation 
*Checkout_payment 
*Checkout_payment_address 
*Checkout_shipping 
*Checkout_shipping_address 
*Checkout_success 
*Conditions 
*Contact_us 
*Contest 
*Contest_rules 
*Cookie_usage 
*Create_account 
*Custom 
*Custom_rules 
*Index 
*Info_shopping_cart 
*Login 
*Logoff 
*Password_forgotten 
*Privacy 
*Product_reviews 
*Products_new 
*Product_reviews_info 
*Product_reviews_write 
*Reviews 
*Shipping 
*Shopping_cart 
*Specials 
*Ssl_check 
*Tell_a_friend 
*Dynamic_sitemap

*Information 
? ? o Shipping & Returns 
? ? o Privacy Notice 
? ? o Conditions of Use 
? ? o Contact Us 
? ? o Site Map

 

Is that list of filenames with the underscores correct?

The information infobox at the end looks good...and appears to use the filenames form filenames.php.  Whereas, the long list is not.

 

Do you have any advice?

 

I also have an infobox that is basically a ripe from "Contact Us" and it choked on it...I had to exclude it.  Even odder, I have a third infobox that is a ripe from "Contact Us" and almost identical to the one that chokes but it worked fine.  That issue is melting my brain!

 

Thanks in advance!

Siddall

I hadn't noticed the underscores before. The names are just taken from the filename. I'll change that at some point. It doesn't affect the result with the SE's though. It is just an appearance problem.

 

If you post the box that is breaking it, I will look at it.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

If you post the box that is breaking it, I will look at it.

 

Jack

 

If I include the infobox that causes the issue, the sitemap looks like this:

 

* Information 
    o Shipping & Returns 
    o Privacy Notice 
    o Conditions of Use 
    o Contact Us 
    o Site Map 

* Custom 
    o CREATE YOUR OWN 
    o

 

The "INFORMATION" infobox looks great...but under it is the "CUSTOM" infobox. It lists the "CREATE YOUR OWN" link and then a blank link under it...just a random bullet point.

 

Here is the code for that infobox from ...includes/boxes/

 

<?php
/*
 $Id: custom.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- custom //-->
         <tr>
           <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_CUSTOM);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CUSTOM) . '"><b>' . BOX_INFORMATION_CUSTOM . '</b></a><br>');
                                         //'<a href="' . tep_href_link(FILENAME_CUSTOM_RULES) . '"><right><small>' . BOX_RULES_CUSTOM . '</small></right></a>');

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- custom_eof //-->

 

I really don't see anything shockingly different...it is basically a ripe of .../includes/boxes/information.php. Let me know what you think!!!

 

Regards,

Siddall

Link to comment
Share on other sites

BOX_INFORMATION_CUSTOM . '</b></a><br>');

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?//'<a href="' . tep_href_link(FILENAME_CUSTOM_RULES) . '"><right><small>' . BOX_RULES_CUSTOM . '</small></right></a>');

 

?new infoBox($info_box_contents);

?>

? ? ? ? ? ?</td>

? ? ? ? ?</tr>

<!-- custom_eof //-->[/code]

 

 

Regards,

Siddall

Remove the commented line
//'<a href="' . tep_href_link(FILENAME_CUSTOM_RULES) . '"><right><small>' . BOX_RULES_CUSTOM . '</small></right></a>'

The code can't handle characters before the <a as it is now. I will change it at some point but for now you can't have them there.

 

Jack

Edited by Jack_mcs

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I'm receiving this as well....

 

Error!

 

Unable to determine the page link!

 

Its showing up at the end of my categories list, I think the fault is in the categories box as a result of this contribution...

 

http://www.oscommerce.com/community/contributions,1480

 

On the filenames with the _ in them, anyway to fix it manually?

I am not familiar with that contribution so I can't help you with it but I think you are correct. The code for the categories section is the same as that used in SiteMap MS2 and that works for a lot of people. You'll need to compare what is different in the categories box to find where the problem lies.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Remove the commented line
//'<a href="' . tep_href_link(FILENAME_CUSTOM_RULES) . '"><right><small>' . BOX_RULES_CUSTOM . '</small></right></a>'

The code can't handle  characters before the <a as it is now. I will change it at some point but for now you can't have them there.

 

Jack

That worked like a charm! Thanks Jack!!!

 

T-DOGG

Link to comment
Share on other sites

  • 4 weeks later...

Hi Jack,

 

I use info_pages contrib instead of the default information box. I get an error on the box but would like to get the pages (links listed). I did read your previous posts about "//" comments and such but could not find any in the code (posted below). Also I have a bullet at the end with no link there??? is that supposed to be? LINK TO PAGE

 

One other note... (in right links pane) shouldn't the posted links be broken down to include the subcategories (like the left pane does with categories box)? For example the links.php shoudl display the subcategories under it??

 

<?php
/*
 $Id: info_pages.php,v 3.3 2004/02/12

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

   $page_query = tep_db_query("select pages_id, pages_title, pages_html_text, sort_order, status,intorext,externallink,link_target  from " . TABLE_PAGES . " where status = 1 and sort_order >0 order by sort_order, pages_title");

?>
<!-- go karts info //-->
         <tr>
           <td>
<?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_PAGES);

   new infoBoxHeading($info_box_contents, false, false);

   $rows = 0;
   $page_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';




   while ($page = tep_db_fetch_array($page_query)) {
     $rows++;


$target="";
if($page['link_target']== 1)  {
$target="_blank";
}



if($page['pages_title'] != 'Contact Us'){

$link = FILENAME_PAGES . '?pages_id=' . $page['pages_id'];



}else{

$link = FILENAME_CONTACT_US;
}

if($page['intorext'] == 1)  {
$page_list .= '<tr><td class="infoBoxContents"><a target="'.$target.'" href="' . $page['externallink'] . '">' . $page['pages_title'] . '</a></td></tr>';
}
else {
     $page_list .= '<tr><td class="infoBoxContents"><a target="'.$target.'" href="' . tep_href_link($link) . '">' . $page['pages_title'] . '</a></td></tr>';
}
   }



   $page_list .= '</table>';

   $info_box_contents = array();
   $info_box_contents[] = array('text' => $page_list);


   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- go karts info eof //-->

 

Any insight is much appreciated.

Thank you, KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

The current code won't be able to read your infobox. It is made to look for specific code in the infobox file. Since that code can be formatted in any number of ways, there is no easy way to parse the file to find the links. I plan on changing the contribution to provide a better parser but there's no telling when that might be.

 

The bullet without a link is probably because it can't deteermine the proper link from the given information. If you are getting an error at the bottom of the window, then this is the reason. Otherwise, I can't say without seeing the code.

 

The reason the categories section shows as sub links is because that is how they are setup in the database. For the right side links, there is no relation between the files so there is no way to say if some of them belong to the same group. It would be nice to list them like that but I don't see how it is possible.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The bullet without a link is probably because it can't deteermine the proper link from the given information. If you are getting an error at the bottom of the window, then this is the reason. Otherwise, I can't say without seeing the code.

 

Thanks for the fast response! great support Jack. What code are you talking about (above) so I can post it, I have no error on the bottom of the page: My Sitemap here

 

~KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

I don't know which section of code it might be. That would depend on your site and where it is failing at. The map either displays links it creates from the files in your root directory or from infoboxes. If that missing link is a file in your root directory, then compare the files you have there with the ones shown on the page and you should be able to figure out which it is.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I've just installed the contribution and I'm getting the following error message

 

1054 - Unknown column 'c.categories_status' in 'where clause'

 

select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.categories_status = '1' and c.categories_id = cd.categories_id and cd.language_id = '1' order by c.parent_id, c.sort_order, cd.categories_name

 

[TEP STOP]

 

I see that this is in reference to the enable/disable categories module (which I'm unfamiliar with). I've tried switching to the second option in the "category_tree.php" file. I've tried commenting out both lines, but still get error messages. I've tried enabling the "Display Category/Manufacturer Filter (0=disable; 1=enable)" option in config and changing the lines in the "category_tree.php" file, but still the same error message.

 

What should I try next?

 

Thanks much

Link to comment
Share on other sites

That code comes from version 1.4. Since that is not part of the standard code, it should not have been uploaded as a new version. Try downloading version V 1.3.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hi,

i installed the 1.4 version and then 1.3 on top as Jack said...I've got teh site map showing but also these lines on top;

 

Invalid code for this module found in the following infobox: Heading

Invalid code for this module found in the following infobox:

Invalid code for this module found in the following infobox:

Invalid code for this module found in the following infobox:

 

my sitemap page link is as follows;

http://nicedeals.co.uk/caraccessories/nfos...308bef13a70e58b

 

one otehr thing, will the search engine pick it up automatically now or do need to submit it?

thanks!

Link to comment
Share on other sites

It's wokring then. It is just finding code it doesn't understand. You will need to do some detective work to isolate which infobox is causing the problem and then add it to the exclude list in modules/dynamic_sitemap.php. The easiest way to do this is by removing the box(ex) from includes.boxes/. If your box is required you can't do this, but most add-on boxes are optional.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I wouldn't know where to start;

 

my dynamic_sitemap.php looks like this;

 

<?php

/*

$Id: dynamic_sitemap.php,v 1.0 2005/06/29

written by Jack_mcs at www.osocmmerce-solution.com

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

require DIR_WS_FUNCTIONS . 'dynamic_sitemap.php';

 

$path = DIR_WS_BOXES;

$pathFileName = DIR_WS_INCLUDES . 'filenames.php';

$pathLanguage = DIR_WS_LANGUAGES . $language . '.php';

$boxText = array();

 

/********************* Find the infoboxes to add ***********************/

if ($handle = opendir($path))

{

$found = false;

$ctr = 0;

while (false !== ($file = readdir($handle)))

{

if (substr($file, -4, 4) !== ".php")

continue;

else if (strpos($file, 'best_sellers') !== FALSE || //ignore these since

strpos($file, 'categories') !== FALSE || //they don't use a

strpos($file, 'currencies') !== FALSE || //standard format

strpos($file, 'languages') !== FALSE ||

strpos($file, 'manufacturer_info') !== FALSE ||

strpos($file, 'manufacturer') !== FALSE ||

strpos($file, 'order_history') !== FALSE ||

strpos($file, 'product_notifications') !== FALSE ||

strpos($file, 'reviews') !== FALSE ||

strpos($file, 'search') !== FALSE ||

strpos($file, 'shopping_cart') !== FALSE ||

strpos($file, 'specials') !== FALSE ||

strpos($file, 'tell_a_friend') !== FALSE ||

strpos($file, 'Account') !== FALSE ||

strpos($file, 'whats_new') !== FALSE )

continue;

 

$file = $path . '/' . $file;

$fp = file($file);

 

for ($idx = 0; $idx < count($fp); ++$idx)

{

if ($posStart = strpos($fp[$idx], "BOX_HEADING") !== FALSE)

{

$parts = explode(" ", $fp[$idx]);

for ($i = 0; $i < count($parts); ++$i)

{

if (strpos($parts[$i], "BOX_HEADING") === FALSE)

continue;

$parts = explode(")", $parts[$i]); //$parts has full box heading text

$name = explode("_", $parts[0]); //ignore the BOX_HEADING part

for ($x = 3; $x < count($name); ++$x) //name may be more than one word

{

if (tep_not_null($name[$x]))

$name[2] .= ' ' . $name[$x];

}

$name[2] = strtolower($name[2]);

$name[2] = ucfirst($name[2]);

$boxHeading[$ctr]['heading'][$ctr] = $name[2];

}

}

else if ($posStart = strpos($fp[$idx], "FILENAME") !== FALSE)

{

$str = str_replace("'<a href=\"' . tep_href_link(", "", $fp[$idx]);

$str = str_replace("\$info_box_contents[] = array('text' => ", "", $str);

 

$parts = explode(")", $str);

$parts[0] = trim($parts[0]);

 

$boxParts = explode(".", $parts[1]);

$boxParts[2] = trim($boxParts[2]);

 

if (tep_not_null($boxParts[2]))

{

$boxHeading[$ctr]['filename'][] = getFileName($pathFileName, $parts[0]);

$boxHeading[$ctr]['boxtext'][] = getBoxText($pathLanguage, $boxParts[2]);

}

else

{

echo 'Invalid code for this module found in the following infobox: '.$boxHeading[$ctr]['heading'][$ctr].'<br>';

array_pop($boxHeading);

$ctr--;

}

}

}

$ctr++;

}

closedir($handle);

}

 

/********************* Find the pages to add ***********************/

$ctr = 0;

($dir = opendir('.')) || die("Failed to open dir");

$files = array();

while(false !== ($file = readdir($dir)))

{

if(! is_dir($file) && substr($file, -4, 4) === ".php") //only look at php files

{

$engFile = DIR_WS_LANGUAGES . $language . '/' . $file;

if (file_exists($engFile) && IsViewable($file))

{

if (strpos($file, "product_info.php") !== FALSE ||

strpos($file, "create_account_success.php") !== FALSE ||

strpos($file, "links_submit_success.php") !== FALSE ||

strpos($file, "checkout_process.php") !== FALSE )

continue;

 

$files['path'][] = $file;

$name = explode(".php", $file);

$files['name'][] = ucfirst($name[0]);

}

}

}

?>

 

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

 

I have no idea what code to look for and what to adjust to correct my site map page ( link attached )

 

http://nicedeals.co.uk/caraccessories/nfos...mic_sitemap.php

Link to comment
Share on other sites

It's not the sitemap code that is causing the problem. It is one of your infoboxes that is confusing. You need to prevent it from displaying that box. Here's another, albeit longer, approach. In the file you posted, duplicate this line:

strpos($file, 'languages') !== FALSE ||

and change languages to the name of of one of your infoboxes. Save and test the site map. If it works, then that infobox is at fault. If not, then dusplicate it again and enter your next inforbox. Check and continue. Eventually, you will find the box that is at fault.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

i just ended up getting rod of some code that gets displayed when there is a problem;

 

$file = $path . '/' . $file;

$fp = file($file);

 

for ($idx = 0; $idx < count($fp); ++$idx)

{

if ($posStart = strpos($fp[$idx], "BOX_HEADING") !== FALSE)

{

$parts = explode(" ", $fp[$idx]);

for ($i = 0; $i < count($parts); ++$i)

{

if (strpos($parts[$i], "BOX_HEADING") === FALSE)

continue;

$parts = explode(")", $parts[$i]); //$parts has full box heading text

$name = explode("_", $parts[0]); //ignore the BOX_HEADING part

for ($x = 3; $x < count($name); ++$x) //name may be more than one word

{

if (tep_not_null($name[$x]))

$name[2] .= ' ' . $name[$x];

}

$name[2] = strtolower($name[2]);

$name[2] = ucfirst($name[2]);

$boxHeading[$ctr]['heading'][$ctr] = $name[2];

}

}

else if ($posStart = strpos($fp[$idx], "FILENAME") !== FALSE)

{

$str = str_replace("'<a href=\"' . tep_href_link(", "", $fp[$idx]);

$str = str_replace("\$info_box_contents[] = array('text' => ", "", $str);

 

$parts = explode(")", $str);

$parts[0] = trim($parts[0]);

 

$boxParts = explode(".", $parts[1]);

$boxParts[2] = trim($boxParts[2]);

 

if (tep_not_null($boxParts[2]))

{

$boxHeading[$ctr]['filename'][] = getFileName($pathFileName, $parts[0]);

$boxHeading[$ctr]['boxtext'][] = getBoxText($pathLanguage, $boxParts[2]);

}

else

{

echo ''.$boxHeading[$ctr][''][$ctr].'';

array_pop($boxHeading);

$ctr--;

}

}

}

$ctr++;

}

closedir($handle);

}

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

can this hurt my site map in any way?

also..do i need to submit the site map now to search engines??

Link to comment
Share on other sites

Removing parts of code prevents the contribution from doing its job. You don't submist anything to google with this contribution. It is just a sitemap that goodle will search when it goes through your site.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

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