1 Reply Latest reply: Nov 27, 2008 3:53 PM by (Purple_Edge) RSS

    SPRY ACCORDION as Dynamic Menu - Phase 1 - the table structure

    oicram Community Member
      Hi all,

      INTRO:
      I need an accordion that goes dynamic. I'm thinking about using a repeat-region even if, for now, I have no clue about it. Anyway, the point is to make a spry accordion look like a menu and in that menu I want to have Categories and Subcategories.
      I belive this is a very complex question, so I have divided on several little ones:
      Phase 1: The Database Structure.
      Phase 2: The Repeat Region.
      Phase 3: The relation with the Products.

      PHASE 1: THE DATABASE STRUCTURE:

      PROBLEM
      Ok, I have a products table. I have categories table. I have on both, a foreign key.

      1) Is this the best approach? Or should we use a third table?

      2) When we delete a category I don't what him to delete the products on that category, (and this is correct right?). But when we update a category it is important to let them update the information on all the products on that category, or not?


      Kind regards,
      Márcio
        • 1. Re: SPRY ACCORDION as Dynamic Menu - Phase 1 - the table structure
          Community Member
          1. Yes. What third table would you need?
          2. No & No.

          You shouldn't be able to delete a category if it has products as children.

          You should have tables..

          Category
          CategoryID (INT) - Primary Key, Auto number
          CategoryName
          etc

          Products
          ProductID (INT) - Primary Key, Auto number
          ProductName
          CategoryID (INT) - Foreign Key to Category
          etc

          If you change something in Category, NOTHING changes in Products.