Professional Web Applications Themes

Product Categories & Subcategories - Macromedia ColdFusion

I want to create a category menu that allows any number of levels of subcategories, that is, you can have a parent category and that category can have a child category, and that child category can have a child category etc. I want to be able to just list the parent categories when the user first enters the page and when they click on a category, the child catgeories appear, and if they click on one of the child categories, then you see the "grandchild" categories. I believe that I may need to have a nested cfoutput using the group ...

  1. #1

    Default Product Categories & Subcategories

    I want to create a category menu that allows any number of levels of
    subcategories, that is, you can have a parent category and that category can
    have a child category, and that child category can have a child category etc. I
    want to be able to just list the parent categories when the user first enters
    the page and when they click on a category, the child catgeories appear, and if
    they click on one of the child categories, then you see the "grandchild"
    categories.

    I believe that I may need to have a nested cfoutput using the group parameter
    for this but am unsure as to how to set up the database and the SQL query for
    this. Or I may be totally on the wrong track!

    If you have or know of a solution for this I would really appreciate it.

    Steve (Sydney)

    Ken Oath Guest

  2. #2

    Default Re: Product Categories & Subcategories

    Hi Steve - if I am understanding you correct and you want to have related
    select boxes then I generally use JavaScript......... here is a link to one
    that I have used in the past
    [url]http://www.mattkruse.com/javascript/dynamicoptionlist/[/url]

    If I have totally misunderstood........ then please repost explainly what you
    want.

    simontux Guest

  3. #3

    Default Re: Product Categories & Subcategories

    A simple DB for this purpose would have the following fields.
    Catid,Parentcatid,Type,label

    Type will have only 2 values - P/C (parent or child).This would help u to
    fetch only the parent records the first time.

    Parent>>Child>>grandchild
    will be present in the DB as
    1,1,P,Parent
    2,1,C,Child
    3,2,C,grandchild

    I think using a tree control would suit your requirement.
    You can use Cftree and feed it with the output of your slect query .

    shockz Guest

  4. #4

    Default Re: Product Categories & Subcategories

    shockz, that's exactly what I would do, except without the type column.

    To get parent categories, all you have to do is check for catid = parentcatid,
    and wherever catid != parentcatid, you have a child category.

    Kronin555 Guest

  5. #5

    Default Re: Product Categories & Subcategories

    Thanks Shockz and Kronin555 for your input. I did want to use a grouped cfoutput to display the outpu in a certain way, rather than use CFTREE. Is there an easy way to implement this?
    Ken Oath Guest

  6. #6

    Default Re: Product Categories & Subcategories

    Kronin555, You r right mate!! The type column is unnecessary.

    Ken, I don' think you can use grouping with this DB.

    If it was me
    1. I'd use CFTREE
    or
    2.Fetch the Parent Categories alone initially.On choosing a category hit the
    DB and fetch all sub categories of the chosen category .Repeat.
    or
    3.Fetch all categories/sub categories at one go, palce them in DIV's .Hide all
    Div's except those of the Parent categories.
    On clicking a category make the div containing itz sub categories visible
    using javascript.

    Hope this helps...






    shockz Guest

Similar Threads

  1. MainCategory and Subcategories Product Display Problem
    By DigiWolf in forum Dreamweaver AppDev
    Replies: 2
    Last Post: May 14th, 05:26 PM
  2. creating a dynamic table with subcategories
    By davellaman in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: May 11th, 06:24 PM
  3. method for making categories/subcategories.
    By Brian in forum PHP Development
    Replies: 6
    Last Post: October 21st, 06:53 PM
  4. [PHP] Subcategories in php
    By Greg Donald in forum PHP Development
    Replies: 2
    Last Post: September 24th, 07:30 AM
  5. Product activation when you've lost your Product ID sticker
    By larry samuels MS-MVP \(XP Shell/User\) in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 5th, 10:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139