Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Site map page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 02-24-2005, 09:06 AM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default 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!
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #2  
Old 02-24-2005, 09:19 AM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

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

Thanks alot fernando!
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #3  
Old 02-24-2005, 11:46 AM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

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

And thanks again for sharing this mod.
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #4  
Old 02-24-2005, 11:53 AM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default

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
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #5  
Old 02-24-2005, 12:28 PM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default

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.
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #6  
Old 02-24-2005, 01:21 PM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

Thisone also looks great!
And for that 'price' I'm going to give it a try, markwoo
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #7  
Old 02-24-2005, 01:28 PM
 
markwhoo markwhoo is offline
 

X-Adept
  
Join Date: Nov 2003
Posts: 799
 

Default

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

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!
__________________
vs 4.1.12
Reply With Quote
  #8  
Old 03-03-2005, 11:57 AM
 
gm@osbcorp.com gm@osbcorp.com is offline
 

Member
  
Join Date: Sep 2004
Posts: 22
 

Default

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!
__________________
Senior
X-Cart Gold v3.5.11
Reply With Quote
  #9  
Old 03-03-2005, 12:03 PM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default

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.
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #10  
Old 03-03-2005, 12:35 PM
 
sstillwell@aerostich.com sstillwell@aerostich.com is offline
 

eXpert
  
Join Date: Jun 2004
Location: Duluth, MN
Posts: 242
 

Default

markwhoo,

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

Anyway, I'm going to try Fernando's site map, looks good.
__________________
No longer using Xcart, was good while it lasted.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:11 PM.

   

 
X-Cart forums © 2001-2020