Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dynamic SiteMap


Jack_mcs

Recommended Posts

well some are repeating them selves like

 

"My Account Information

My Account Information"

 

some words like

 

" What "

 

and then words like

 

" I "

 

" %s Reviews "

 

and the left colon is also long

 

can you help me with this ??

The names of the links are built from the text in the language file. You can change that text to fix the problem, although sometimes that is not possible, or you can add the link to the exclude list. To do that, just roll the mouse over the link and the file you need to exclude will appear at the bottom of the browser.

 

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

ok jack that's fine, but what if i need to remove all file links that are avaiable to members only. will i need to all the restricted areas links to the exclude list also, it there any other way.

 

one more thing you said those names come from language files, but why do then i have

 

define (

 

for my homepage

Link to comment
Share on other sites

Yes, you have to exclud ethem all. I don't know why you are seeing that. I suppose the language file doesn't have the heading define.

 

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

see the language file's header contents

 

 

// header text in includes/header.php

define('HEADER_TITLE_CREATE_ACCOUNT', 'Create an Account');

define('HEADER_TITLE_MY_ACCOUNT', 'My Account');

define('HEADER_TITLE_CART_CONTENTS', 'Cart Contents');

define('HEADER_TITLE_CHECKOUT', 'Checkout');

define('HEADER_TITLE_TOP', 'Home');

define('HEADER_TITLE_CATALOG', 'Catalog');

define('HEADER_TITLE_LOGOFF', 'Sign Out');

define('HEADER_TITLE_LOGIN', 'Sign In');

 

// footer text in includes/footer.php

define('FOOTER_TEXT_REQUESTS_SINCE', 'requests since');

Link to comment
Share on other sites

hi, ok jack the next thing i did like to do is to dynamically create links for my menus, just like the information box.

 

where should i go editing it , i have my drop-down menu at bhuratea.com , i want the links to form as

 

Menu 1

COnent

Conten

Menu 2

Conten

COnte

Information

COntact

Privacy

Shipping

 

any help would be nice, as i installed this cont for my menu functionality.

 

thanks

Link to comment
Share on other sites

The names of the links are built from the text in the language file. You can change that text to fix the problem, although sometimes that is not possible, or you can add the link to the exclude list. To do that, just roll the mouse over the link and the file you need to exclude will appear at the bottom of the browser.

 

Jack

 

I have put the (What) word the mouse over it and got shopping_cart.php so I pu tit in the exclude i think is in catalog/include/module/dynamic_sitemap.php

 

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

 

but it doesnt work what should i do now ???

 

please help

Link to comment
Share on other sites

I have installed "Dynamic SiteMap" and in the install guide is a note

"Some files and infoboxes are not meant to be displayed in a sitemap.

In catalog/includes/modules/sitemap.php, there are two places

where some files are excluded."

I can't find the sitemap.php file ?

Link to comment
Share on other sites

If you post a link to your site, I will look at it and see if I can figure it out.

 

Jack

 

here is my link

 

http://www.khunbetta.com/dynamic_sitemap.php

 

<?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, 'affiliate') !== FALSE ||

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

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

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

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, 'shopping_cart') !== 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, '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

{

if (tep_not_null($box_heading))

{

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;

 

$fp = file($engFile);

 

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

{

if (strpos($fp[$idx], "define('HEADING_TITLE") !== FALSE)

{

$fp[$idx] = stripslashes($fp[$idx]);

$p_start = strpos($fp[$idx], ",");

$p_start = strpos($fp[$idx], "'", $p_start);

$p_stop = strpos($fp[$idx], "'", $p_start + 2);

$files['name'][] = ucfirst(substr($fp[$idx], $p_start + 1, $p_stop - $p_start - 1));

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

break;

}

}

}

}

}

?>

Link to comment
Share on other sites

I don't see a V 1.61 so i can't comment on that. But if you have the version rigth before V 1.6, the difference is only one file. You could upload that and see if it works. If not, just upload your old file again (which you would have backed up, of course).

 

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 don't see a V 1.61 so i can't comment on that. But if you have the version rigth before V 1.6, the difference is only one file. You could upload that and see if it works. If not, just upload your old file again (which you would have backed up, of course).

 

Jack

 

There was a problem with part of the code which meant that nested list was generated incorrectly leading to validation errors

 

This is just a replacement for the /catalog/includes/classes/category_tree.php

 

Now the html tags are in the right order.

<?
/*
$Id: category_tree.php,v1.2 2004/05/10 hpdl Exp $
# corrected the nested lists

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

Copyright (c) 2004 osCommerce

Released under the GNU General Public License
*/

class osC_CategoryTree {
var $root_category_id = 0,
$max_level = 0,
$data = array(),
$root_start_string = '',
$root_end_string = '',
$parent_start_string = '',
$parent_end_string = '',
$parent_group_start_string = '<ul class="sitemap">',
$parent_group_end_string = '</ul> ',
$child_start_string = '<li>',
$child_end_string = '</li> ',
$spacer_string = '',
$spacer_multiplier = 1;

function osC_CategoryTree($load_from_database = true) {
global $languages_id;
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.parent_id, c.sort_order, cd.categories_name");

$this->data = array();

while ($categories = tep_db_fetch_array($categories_query)) {
$this->data[$categories['parent_id']][$categories['categories_id']] = array('name' => $categories['categories_name'], 'count' => 0);}
} //end class osC_CategoryTree

function buildBranch($parent_id, $level = 0) {
$result = $this->parent_group_start_string; //starts the <ul> tag

if (isset($this->data[$parent_id])) {
	foreach ($this->data[$parent_id] as $category_id => $category) {
		$category_link = $category_id;

		$result .= $this->child_start_string; // prints <li>

		if (isset($this->data[$category_id])) {$result .= $this->parent_start_string;} //prints nothing

		if ($level == 0) {$result .= $this->root_start_string;} //prints nothing

		$result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level) . '<a title="'. $category['name'] . '" href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';

		$result .= $category['name'];

		$result .= '</a>';

		if ($level == 0) {$result .= $this->root_end_string;} //prints nothing

		if (isset($this->data[$category_id])) {$result .= $this->parent_end_string;} //prints </ul>

		if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
		$result .= $this->buildBranch($category_id, $level+1);}

		$result .= $this->child_end_string; //prints </li>

	}// end foreach
} // end if (isset 

$result .= $this->parent_group_end_string; //<prints </ul>

return $result;
} //end function

function buildTree() { return $this->buildBranch($this->root_category_id);}}

?>

Julie

Link to comment
Share on other sites

Sorry it is called corrected category_tree.php

 

I do not know how to compare the two files nor understand html so am not sure if I should upload this file, as it hasn't appeared on the support thread?

 

Thanks

Julie

Link to comment
Share on other sites

I have just done a CSE HTML validator check on Jack's category_tree.php & it says congratulations No errors. :thumbsup: So I am taking that to mean it is OK & I do not need to download the latest corrected category_tree.php file & replace the original, just in case anyone is interested. :D

 

Julie

Link to comment
Share on other sites

  • 2 weeks later...

Hi Jack,

 

Thanks for the great contribution - just a quick question, I have installed this & so far so good :thumbsup:

if I may ask you though - do you know what the next step is & or what it is I need to do in order to get this indexed into google site map?

 

much thanks

Lexi

Link to comment
Share on other sites

By "google site map" I assume youi mean the google index, not their site map. There are quite a few changes needed for an oscommerce site to place well but discussion of them doesn't belong in this this thread. Search the forums for SEO and you will find many threads that deal with this topic.

 

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

  • 2 weeks later...

I just need to glout - sorry! *grins*

 

I just installed this contribution with no problems. It took me about an hour mainly cause I had 25 files to add to the exclusion list and the information box also (cause it was repeating links). It also ended up showing me a few files I missed in fixing up to conform with the rest of my site. I'm still trying to decide if I want to pare down the list of existing links showing though.

 

Say, the links on the right - Informational links - any way to put them in Alphabetical Order?

 

I'm falling asleep - I'll submit in my sitemap to Google later on today.

 

Thank you, Jack for this contribution!

Link to comment
Share on other sites

How to sort has been asked before. I posted some code but I don't recall the result. You can read through this thread to find it. I will at sorting to the next update but I can't say when that will be.

 

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

Alphabetizing - the code you had suggested to go before the last ?> does not work, as I get the same errors as the person who was trying to get it to work at the time - the right column of links disappearing.

 

I just wanted to alphabetize those links for a Customer Service Aesthetic looking thingy (I'm so technical! LOL), but not a priority and will wait to see if you add a fix for this in upcoming updates.

 

Also, the same person was adding in other site pages (html) and you gave the following code to adding before the last ?>:

$files['name'][] = 'Link Name';
$files['path'][] = 'file.php';

 

I tried that and entered a path to my .html pages, just one for testing and it gave me when you hover your mouse over the link:

http://www.mysite.com/catalog/http:www.mysite.com/page.html.

 

I have several key .html pages that should be included in the site map that are: www.mysite.com/page.html and my store is at: www.mysite.com/catalog.

 

Now, when I entered the path to the page, I did type in the full URL since it was outsite of the catalog, figuring it would need that. Was I wrong? Any other suggestions?

 

Thanks in advance.

Link to comment
Share on other sites

Jack,

 

This was your answer:

At the very bottom of the file before the ?>, add this
$files['name'][] = 'Test Link';
$files['path'][] = 'test.php';

You will need to change them to whatever you want of course but it should work.

 

Jack

 

The initial question was post #120 (bottom of page 6 for me), which posts #:121,123,124, and your answer of #126 above. (all on page 7 of the thread).

 

It worked in every way except for the actual hyperlink itself - that doesn't display right when hovering your mouse over it and obviously thus doesn't go to the correct URL. It might just be how I write the path since my .html pages are outside of catalog and in the root of the site itself, whereas the code above wants to look in /catalog/ for the files.

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