[ic] Nested Loops - Newbie

Jeff Fearn interchange-users@interchange.redhat.com
Tue Nov 13 01:06:01 2001


Hi I am trying to get it so that a menu link for a category only links to 
products in that category and in the area it is displayed under.

i.e 2 products one in Software with OS, The other in Courses with OS. 
Currently clicking on either link will display both products.

Software:
     Operating Systems

Courses
     Operating Systems

I believe the relavent code is in templates/components/category_verticle :

...snip...
<!-- BEGIN COMPONENT [control component category_vertical] -->
[timed-build auto=1 if="[control timed 0]" minutes="[control timed 0]"]
[set found_cat][/set]
[loop
        prefix=box
        search="
                fi=area
                st=db
                tf=sort
                ac=0
                ac=0
                co=yes
                sf=sel
                op=eq
                se=[control set_selector left]

                sf=which_page
                op=rm
                se=[control page_class all|@@MV_PAGE@@]
"]

  <tr>
    <td valign="top" class="categorybar">
      <b>[box-exec bar_link]area[/box-exec]</b>
    </td>
  </tr>
  <tr>
  </tr>
  <tr>
    <td valign="top" class="categorybar">

[set found_cat]1[/set]
[loop prefix=cat
        search="
                fi=cat
                st=db
                tf=sort
                tf=name
                rf=code,name
                sf=sel                # Have to add box-sf
                se=[box-code]         # have to add box-se for above sf
        "
        ]
      &nbsp;&nbsp;[cat-exec bar_link]cat[/cat-exec]<BR>
[/loop]
...snip...

I assume I can just add another sf/se pair, but how do I get the prod_group 
from the box loop?

I am also assumin that the outer loop gets the area and the inner loop the 
category, which I believe I have validated by prionting out the code 
returned in both loops.

I know I could make 2 different categories and set the prod_group in each, 
however that will eventually become very messy.

Thank's Jeff.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp