[ic] using loops

Ben Humphrey ben@humphrey.net
Thu, 7 Sep 2000 10:17:12 -0700


Hi folks,

I'm trying to build a drop-down product selector with a small catalog.  I'd
like the customer to be able to select either a category page or a product
page.  I've been banging my head trying to figure out how to nest a loop so
that the outer loop will give me the categories and the inner loop will
give me the associated products, but I don't seem to have the right syntax
for the nested loop.  Can anyone give me a pointer?

Here's the general idea (after a lot of trial and error):

     <FORM ACTION="store" METHOD=GET>
        <INPUT TYPE=hidden NAME=mv_coordinate VALUE=1>
        <SELECT NAME="newLocation"
onChange="jumpPage(this.form.newLocation)">
        <OPTION VALUE="">Product Selector
        [loop
          search="
            fi=cat
            st=db
            ra=yes
        "]
          [set my_searchname][loop-data cat searchname][/set]
          <OPTION
VALUE="/store/scan/fi=products/st=db/co=yes/sf=category/se=[s
cratch my_searchname]"> [loop-data cat name]<BR>
          [loop
            search="
              fi=products
              st=db
              sf=category
              se=[scratch my_searchname]
          "]
          <OPTION VALUE="/store/[loop-data products sku]">[loop-field sku]
          [/loop]
        [/loop]
        </SELECT>
      </FORM>

Thanks for any help!
-Ben Humphrey