View Single Post
  #2  
Old 11-16-2002, 10:51 PM
 
derrick92130 derrick92130 is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: San Diego, California USA
Posts: 68
 

Default Cascading Category/SubCategory Listings

Unfortunately, I have planned on doing this for a customer, but have not worked through it yet. But, I'll take a stab at this one...

If you are at the top level of the category tree, the subcategories are the same as the top-level categories, and that is why the first piece of code shows the main categories where you are expecting to see subs. The reason they aren't repeated is likely because you are using the same counter (cat_num) for both section loops. When it finishes the second section loop, the counter is left at the end and is falling out of the both the nested and outer loop.

In the second piece of code your two loops are exclusive of one another, meaning that the first loop completes {/section} prior to starting the second loop. At the top level, I would expect it to run the whole category listing twice?

Sorry, this has been more diagnostic of your code and not helping yet.

The first code snippet looks the closest. You need to give each counter variable a different name and add a test to see if the category is the same as the category that was selected prior to listing the subcategories. Otherwise, you will not know where to cascade the subcategory listing. I can work up an example next week if you still are stuck.

Hope this helps!
__________________
-Derrick
FreeRangeMinds, LLC
Reply With Quote