Hello! I’m developing a food delivery app and have been looking for ways to implement the functionality for adding certain ingredients or topping depending on the category of the item, ie:
(for these categories of ingredients, you can choose every item )
Protein, you have: bacon, double burger
Extra ingredient you have: pickles, cheese, onion rings.
(for these categories, you can only choose from one of the ingredients)
Bread you have: regular, brioche or sesame seeds
Sauce/Dressing: chipotle, guacamole, special sauce
So you have the type of ingredients that can be multiple selected or the ingredients where you can choose only one from that category, and thats another problem that i haven’t resolved yet, how to show and store the “choose only one from this category” in the related item if the client can upload many of this categories of new ingredients
I have two components that show the ingredients of the chosen categories but cant figure the solution yet
In this image we can see that the category chosen is “protein” where the user can choose between bacon and double meat, when choosing both this goes to select multiple choice component.
The issue goes when you select another category, for example, extra ingredient, and you select it, this erases the cell where the ingredients are and writes just the last one selected from that category.
In other words, you can choose ingredients just from one category, if you choose one from another category the cell just picks the ingredients from the last category you choose ingredients from
User chose the ingredients that they want in their item. The admin of the app can upload the categories of topping, dressing or extra ingredients with the price for each one of these ingredients.
When choosing from the multiple choice component, ingredients are added to a column, but when choosing ingredients from another category the cell with the stored values is re-written with the newly chose ingredient from the another category instead of been added to the cell with the list of ingredients added from another category
Here we can see that we select two ingredients from the category “proteína” that add to the cell “producto armado” and then if we select another ingredient in this example “queso derretido” from the “lacteo” category, instead of the ingrediente added as: “tocino extra, carne extra, queso derretido” it just rewrites as “queso derretido”
It does sound like the default behaviour of a multiple choice component in Glide, so what I would suggest, without knowing if it actually fits with your data structure, is having multiple input fields for each category. That only works if you know in advance how many categories you can have though.