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

Getting subcategories for a specific main category?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-22-2005, 08:07 AM
 
jb5ep jb5ep is offline
 

Advanced Member
  
Join Date: Apr 2005
Location: U.K.
Posts: 65
 

Default Getting subcategories for a specific main category?

Any help on this would be appreciated....

I'm trying to present 2 drop downs on our home page:

1. A drop down to show all main categories

No probs. Got this working with some help from this forum. Code looks like this:

Code:
<select name="site" size=1 class="inputfield"> <option value="">Go to.... {section name=cat_num loop=$categories} <option value="home.php?cat={$categories[cat_num].categoryid}">{$categories[cat_num].category} {/section} </select>

..and it renders like this:

http://www.groovemedia.co.uk/temp/dd_example1.gif


2. Sub-categories within only one specific main category

This is where it gets tricky. I have one main category called 'By Design'. Within this category are many sub-cats. i.e.:

..By Design
...................Anya
...................Bibi
...................Cari

...and what i'd like to do is to generate a drop down (as per #1 above), but to only get the subcats within the main 'By Design' category.

Anyone got any pointers?

Cheers,
__________________
X-Cart 4.0.17
ezUpsell
PHP 4.4.1
MySQL 4.0.25-standard
Apache 1.3.34
Linux
Reply With Quote
  #2  
Old 08-15-2005, 02:23 AM
 
vivienne vivienne is offline
 

Senior Member
  
Join Date: May 2004
Location: Brisbane, Australia
Posts: 121
 

Default This is what I would like too - anyone solve it?

Or at least I would like a separate menu for one subcategory branch that works just like the main categories menu but the root is one particular subcategory
__________________
X-Cart 4.18
www.naturalvetcompany.com
www.wkyp.com.au
Reply With Quote
  #3  
Old 08-15-2005, 03:50 AM
 
vivienne vivienne is offline
 

Senior Member
  
Join Date: May 2004
Location: Brisbane, Australia
Posts: 121
 

Default any help would be great

I tried putting this into my home.tpl
{* {include file="customer/treatmentTypes.tpl"} *}

then setting all the subcats I want to be greater than 500 then putting this into the treatmentTypes.tpl

{* $Id: treatmentTypes.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *}
{capture name=menu}
{section name=cat_num loop=$subcategories}
{if $categories[cat_num].categoryid >= 500}
<FONT class="CategoriesList">{$subcategories[cat_num].category}</FONT>

{/if}{/section}

but it doesn't work. I have bought myself a php book though

Viv
__________________
X-Cart 4.18
www.naturalvetcompany.com
www.wkyp.com.au
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 03:45 AM.

   

 
X-Cart forums © 2001-2020