0 Replies Latest reply on Jun 14, 2009 11:56 AM by newchickinCF

    Categories and Long term Issue?

    newchickinCF Level 1

      I think i have long running problem with categories and it will stay with me as such, anyways let come to the point.

      I am trying to list categories in a suckertree code based on CSS from this website:

      http://www.dynamicdrive.com/style/csslibrary/item/suckertree-menu-vertical/

      Now i modified it a bit on following ways.

      Load the categories only, i mean main categories which have the parentID of 0.

      they loaded perfectly.

      Now on cliking the category, i tend to ask the User the selected city, after city selection. the sucker tree should load the subcategories of the categories pertaining to the selected city.

      The above is my mission.

      I have the following with me as i did tried to complete it.

      Here is the navigation which loads the categories and subcategories on selection menu:

       

      <div class="suckerdiv">
      <ul id="suckertree1">
      <cfif IsDefined('session.city') AND session.city NEQ 1>
      <cfoutput query="Stuff">
      <li><a href="index.cfm?action=city&category=#URLEncodedFormat(catID)#">#catName#</a></li>
      </cfoutput>
      <cfelse>
      <cfloop query="stuff">
      <cfoutput>
      <li><a href="index.cfm?action=city&category=#URLEncodedFormat(catID)#">#catName#</a>
      </cfoutput>
          <ul>
           <cfoutput query="getvalues">
              <li><a href="##">#catname#</a></li>
              </cfoutput>
          </ul>
      </li>
      </cfloop>     
      </cfif>
      </ul>
      </div>

       

      you will see query stuff. as it has the following code:

      SELECT categories.*
      FROM categories
      WHERE catvisibility = <cfqueryparam cfsqltype="cf_sql_numeric" value="1">
      AND parentID = <cfqueryparam cfsqltype="cf_sql_numeric" value="0">


      now there is another query getvalues you see in above code:

      getvalues have the query like this:

      SELECT dpages.catID , dpages.cityID, c1.catName, cities.*
      FROM dpages
      inner JOIN cities ON dpages.cityID = cities.cityID
      left Join categories c1 on dpages.catID = c1.catID
      WHERE
      dpages.cityID = <cfqueryparam cfsqltype="cf_sql_numeric" value="#arguments.city#">
      GROUP BY c1.catName

      in my dpages. i have CITYID as column which exists also in cities table.

      now when i click the category and then i get screen to choose city, i choose city and on clicking city the above query is executed. i set up the session value to keep track of selected value while navigating from page to page. it shows me results like:

      FOOD has 1 subcategory

      and

      Hangouts have 1 subcategory

      Both under the same City.

      But in the CODE BLOCK written top above i run it and it shows the two subcategories under each and every category.

      The Dom Source code is below:

       

      <ul id="suckertree1">

       

      <li><a class="subfolderstyle" href="index.cfm?action=city&category=28">Food</a>

          <ul style="left: 160px; visibility: visible; display: none;">
          
              <li><a href="#">Bar</a></li>
             
              <li><a href="#">Five Star</a></li>
             
          </ul>

      </li>


      <li><a class="subfolderstyle" href="index.cfm?action=city&category=27">Hangouts</a>

          <ul style="left: 160px; visibility: visible; display: block;">
          
              <li><a href="#">Bar</a></li>
             
              <li><a href="#">Five Star</a></li>
             
          </ul>
      </li>

       

      I think i am doing something horribly wrong, Please guide me the corect path i should work and do it please