5

I stucked in a Problem When Playing with Drop Downs.I tried to use this http://www.grocerycrud.com/forums/topic/1087-updated-24112012-dependent-dropdown-library/

But actually my requirement is quite different. I have a table fwld_products in which i am adding all other table's categories, from

fwld_cat_main (main Category's ID),

fwld_cat_sub1 (sub1 Category's id)

fwld_cat_sub2 (sub2 Category's id)

fwld_cat_sub3 (sub3 Category's id)

I want to Display Dropdown in such a way, when user Selects main Category, the Drop Down Appear (sub1) Having Data related to main category and when sub1 selected drop down appear (sub2) showing data related to sub1, and sub2 selected and drop down appear(sub3) to show data related to Drop down (sub2).

When submitted Finnally data inserted to [fwld_products].

Here I am attaching ERD, and result as well.

enter image description here enter image description here

Please help

Engr Saddam Zardari
  • 1,057
  • 1
  • 14
  • 27
  • Have a look at its already there you need to just give it a try [**http://www.grocerycrud.com/forums/topic/1087-updated-24112012-dependent-dropdown-library/**](http://www.grocerycrud.com/forums/topic/1087-updated-24112012-dependent-dropdown-library/) – M Khalid Junaid Mar 22 '14 at 20:21
  • I use the GroceryCRUD dependent dropdown library to do exactly this in multiple projects. It is absolutely possible to use that library to do what you want to do. Just give it a try, and then post your code when you have a problem. – Lee Salminen Mar 22 '14 at 23:46

2 Answers2

2

Hold on, it seems that DB structure of your categories table needs to be improved. What I suggest is that you follow footprints from some of the popular CMS like Opencart. It will give you a great sense to accomplish your task. You can easily optimize your DB by using just one "category" table (instead of main, sub1, sub2, and sub3 category tables) like this:

category

For category names, description, and meta keywords etc you can create this table "category_description":

category_description

Finally to assign categories to the products you can simply create another table "product_to_category":

product_to_category

In this way you can easily manage your data in DB and you can now easily tackle your situation using Codeigniter and Grocerycrud.

Ali
  • 5,021
  • 4
  • 26
  • 45
0

Try, Chained Selects Plugin for jQuery and Zepto (Github Project | Project Home)

If you use or in your project, this plugin will help you to solve your problem, Specially the remote version. You can create related select boxes easily.

Hope this helps :)

Ijas Ameenudeen
  • 9,069
  • 3
  • 41
  • 54
  • 2
    @|Jas Thanks, But I ma using codeigniter CRUD Library, must be remembered ! – Engr Saddam Zardari Mar 17 '14 at 13:02
  • 1
    That is not a problem. I have suggested to use this plugin in the front end. You can make AJAX requests through this and retrieve the data from the CRUD lib. – Ijas Ameenudeen Mar 17 '14 at 14:01
  • 2
    can you do it for me, and i will accept your answer.... i can provide you code and data base..! – Engr Saddam Zardari Mar 18 '14 at 06:39
  • 1
    Everything is in that plugin, you can do it yourself.FYI, This a Q/A site. I can do, but not here. Hope you understand. – Ijas Ameenudeen Mar 19 '14 at 04:22
  • 2
    GroceryCRUD has an extension already to do it within the the confines of the library. Customizing gCRUD to use this jQuery plugin is far more difficult to do. http://www.grocerycrud.com/forums/topic/1087-updated-24112012-dependent-dropdown-library/ – Lee Salminen Mar 24 '14 at 02:27