Hello,
Just a modification from html_sucks' displaying categories tree. This MOD allows for a "site map" type page.
You can check it out at:
http://mascotasmexico.com/tienda/sitemap.php (please consider that this is a
live shop!)
Hope you'll find it useful

!
1. Create file "sitemap.php" on your xcart root directory
Code:
<?php
require "./auth.php";
require $xcart_dir."/include/categories.php";
$smarty->assign("main","sitemap");
func_display("customer/home.tpl", $smarty);
?>
2. Create template skin1/customer/sitemap.tpl
Code:
{* $Id: sitemap.tpl,v 1.00 2005/02/24 09:53:29 max Exp $ *}
{capture name=sitemap}
<ul> {*** start unordered list***}
{section name=l1_cat_num loop=$allcategories} {*** loop ALL categories ***}
{if $allcategories[l1_cat_num].parentid eq 0} {*** loop root categories/parentid 0 - level 1***}[*]
{$allcategories[l1_cat_num].category}
{if $allcategories[l1_cat_num].subcategory_count gt 0} {*** check if root cat has child cats ***}
<ul>
{section name=l2_cat_num loop=$allcategories} {*** loop through sub cats with matching parent id ***}
{if $allcategories[l2_cat_num].parentid eq $allcategories[l1_cat_num].categoryid}[*]
{$allcategories[l2_cat_num].category}
{if $allcategories[l2_cat_num].subcategory_count gt 0} {*** check if parent has child cats***}
<ul>
{section name=l3_cat_num loop=$allcategories}
{if $allcategories[l3_cat_num].parentid eq $allcategories[l2_cat_num].categoryid}[*]
{$allcategories[l3_cat_num].category}
{if $allcategories[l3_cat_num].subcategory_count gt 0} {*** check if parent has child cats***}
<ul>
{section name=l4_cat_num loop=$allcategories}
{if $allcategories[l4_cat_num].parentid eq $allcategories[l3_cat_num].categoryid}[*]
{$allcategories[l4_cat_num].category}
{/if}{/section}[/list]
{/if}{/if}{/section}[/list]
{/if}{/if}{/section}[/list]
{/if}{/if}{/section}[/list]{/capture}
{include file="dialog.tpl" title="Site map" content=$smarty.capture.sitemap extra="width=100%"}
3. Add the following lines near the bottom of skin1/customer/home_main.tpl
Code:
{* Lines added for sitemap *}
{elseif $main eq "sitemap"}
{include file="customer/sitemap.tpl"}
{* End of added lines *}
{else}
{include file="common_templates.tpl"}
{/if}
Finally, add a call to sitemap.php somewhere. For example: to add it at the bottom of the categories menu, alter skin1/customer/categories.tpl near the bottom:
Code:
<FONT class="CategoriesList">
Site map</FONT>
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }
Enjoy!
