X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Site map page (https://forum.x-cart.com/showthread.php?t=12393)

fernando 02-24-2005 09:06 AM

Site map page
 
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! :-({|=

Jerrad 02-24-2005 09:19 AM

Awesome, exactly what I was looking for!
I'll give it a try tonight.

Thanks alot fernando! :D :D

Jerrad 02-24-2005 11:46 AM

It works great fernando!
Any ideas how to include other (help)menu links and maybe
also products?

And thanks again for sharing this mod. :D

fernando 02-24-2005 11:53 AM

Quote:

Originally Posted by Jerrad
It works great fernando!
Any ideas how to include other (help)menu links and maybe
also products?


I'm glad you liked it! Including products would be a bit harder, both on the php side (retrieving the products lists for each category) and the tpl (displaying it nicely). I guess this would make sense for a store with very few products, but not so much for a store with many products as the results would be pretty ugly (not to mention the download times!)

What kind of help menu are you referring to?

fernando 02-24-2005 12:28 PM

No offense taken, on the contrary :) I too think it's great to see that, even though XC is a commercial software, people take advantage of the fact that is an OpenSource product and share their improvements on this product.

Jerrad 02-24-2005 01:21 PM

Thisone also looks great!
And for that 'price' I'm going to give it a try, markwoo :wink:

markwhoo 02-24-2005 01:28 PM

Quote:

Originally Posted by Jerrad
Thisone also looks great!
And for that 'price' I'm going to give it a try, markwoo :wink:


Well, just to state again, I have seen multiple "For Sale" mods for the site maps and I am sure there are multiple features that make them great, but since Fernando has added this FREE mod Kudos to him for this.

The site link I sent to you is from a site I have stumbled accross and it appears that you can add custom links and that was what I needed to do as well.

I am going to try to add this to the cart this weekend and give it a shot.

I think the biggest plus was they were also giving it away for a little info and that to me was cheap enough.


Again, Kudos out to Fernando for his contribution!

gm@osbcorp.com 03-03-2005 11:57 AM

That looks great Fernando! Is it compatable with 3.5.x? I've been looking for a simple site map mod, and this looks like it may be it! :D

fernando 03-03-2005 12:03 PM

I'm not sure if it will work with 3.5 as is, it just might... Since I entered X-Cart at 4.0x, didn't have the chance to test it against previous versions.

Please feel free to try it with 3.5 (I would strongly suggest you try it on a test server, even though this mod doesn't really have impact on existing code nor data, but better be on the ultra-safe side :) ) and do let me know if it worked for you.

sstillwell@aerostich.com 03-03-2005 12:35 PM

markwhoo,

Hmmm, looks like the link to your sitemap is broken.

Anyway, I'm going to try Fernando's site map, looks good.


All times are GMT -8. The time now is 03:47 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.