Multilevel categories

Hi, I am implementing multilevel category type in my marketplace app just like amazon. My categories for eg. level 1- Mobiles & Computers, level 2- Mobiles, Computers, Power Banks, Level 3 - Mobile Accessories, Covers, Parts, etc. And I am storing the categories in a single Data Type (not option sets) with Parent ID and Index. The problem is when I display items in my Home page, the items are displayed only when I click the lower most category because when I add a product it is saved to the lower most category. But I want all the items in all sub categories to be displayed when I click the parent category. Is there a way? please help… (for your info: My list of categories are hundreds…)

On the data type of Category, you should have a field of type category so as to relate the items sub category items into the Main Category.

So, you have a Main Category of Mobiles & Computers and a sub Category of Mobiles…on the Mobiles entry in the database you should populate the field that is also of type category to the main category of Mobiles & Computers.

Then you have a Level 3 (sub sub category) of Mobile Accessories, which for the field of Category, should get populated with Mobiles (ie: the sub category of Mobiles & Computers).

Then when you want to show all main categories, you have a repeating group with Do a Search and the constraint will reference the field of Category and the value should be empty.

Then if somebody clicks onto the Mobiles & Computers Main Category, your RG should have a datasource of Do a Search for Categories with the constraint using the category field to be equal to Mobiles & Computers.

There are various ways to store the selected categories, and since you are trying to create an App like Amazon, you should play like the big boys play and use the URL to store these values, which can be done via parameters or path lists…parameters is easier to work with in Bubble.

So when you create the constraint for the search used to populate the RG when a main category has been selected, you can reference the selected value by referring to the URL parameter that has the selected value in it…to learn more about using URL parameters, you can search forum and find plenty of posts on the subject.

Going further down field, if you want to show all the Level 3 categories based on the selection of a level 2 category, you do the same thing as needed for the search in the datasource of the RG to reference in constraint the category field and equals to the level 2 selection.

Before you try to put all of them into your Bubble database, make sure you have organized them properly so that you can more systematically add them to your Bubble database ensuring you match the values properly using the category field on the category data type.