Create a shopping cart and a record of those sales by users / Crear un carrito y un registro de esas ventas por usuario

Hello!

I am building a web app to manage recipe expenses. There is an ingredients database with name, category, and price. I need to be able to generate a recipe by adding quantities and getting a total (like a purchase). I also need these recipes (purchases) to only be visible to the user and for them to be able to add their own ingredients with their prices. I have everything advanced but I can’t get the “costs” of the recipes (sales). Can anyone help me?


Hola!

Estoy realizando una web app para gestionar gastos de recetas. Hay una base de datos de ingredientes con nombre, categoría y precio. Tengo que ser capaz de generar una receta añadiendo cantidades y que me haga un total (Como si fuese una compra). También necesito que esos recetas (Compras) solo puedan ser vistas por el usuario además de poder añadir sus propios ingredientes con sus precios. Tengo todo avanzado pero no soy capaz de sacar los “costes” de las recetas (Ventas). ¿Alguien me puede ayudar?

Hola!

Tienes que usar User-Specific column para individualizar la gestión de las recetas por usuario y así puedas tener luego el costo de cada receta hecha por c/u.

Empieza por aquí Glide Docs • User-specific columns

Saludos

I think you would need 3 tables for this.

Ingredients table:

RowID Ingredient Name Price
Ingredient001 Flour $0.50
Ingredient002 Sugar $0.75
Ingredient003 Eggs $2.00
Ingredient004 Milk $1.50
Ingredient005 Butter $2.50
Ingredient006 Cocoa Powder $3.00
Ingredient007 Bananas $1.00

Recipes table:

RowID Recipe Name Email
Recipe001 Chocolate Cake chef@example.com
Recipe002 Banana Bread chef@example.com

Recipe Items table

Recipe ID Ingredient ID Quantity
Recipe001 Ingredient001 1
Recipe001 Ingredient002 1
Recipe001 Ingredient003 2
Recipe001 Ingredient004 1
Recipe001 Ingredient005 1
Recipe001 Ingredient006 1
Recipe002 Ingredient001 1
Recipe002 Ingredient002 1
Recipe002 Ingredient003 2
Recipe002 Ingredient004 1
Recipe002 Ingredient005 1
Recipe002 Ingredient007 2

I imagine the flow would be:

  • The users should be able to add ingredients to the ingredients table, but ideally, you would have to check for duplicates, and make sure the prices are right.

  • The users should be able to add recipes to the recipes table, and you should be able to collect the user’s email/rowID when they do so.

  • In the details view of each recipe, allow users to add items to the recipe using a form. You should collect the ingredient’s ID, quantity, and write the recipe ID alongside those to the Recipe Items table.

  • In the Recipe Items table, create a relation from the Ingredient ID to the RowID column of the Ingredients table. Return the price of each ingredient through a lookup column. Add a math column to return the cost of each row (price x quantity).

  • Create a relation from the Recipes table to the Recipe Items table (RowID > Recipe ID), make it a multiple match, and then use a rollup column to sum the “cost” of all related rows. You should get the cost of each recipe.

1 Like

Perfecto! Lo voy a intentar y te cuento de vuelta. Gracias!

Ok! I will try and let you know! Thanks

1 Like

Finally I used one Glide Official tamplate to make It. Thanks!

1 Like

Which glide official template you used ?

This Glide • Coffee Shop Business Template – Coffee Shop Business page

But now im trying to set all login system and personal recipees and it is becaming imposible. I had all system created. You can login and make recipes, add ingridients, updates costs… but if one user change one price, this change for all users.

I know I need get ID per new row. I shaw all official an unofficial glide tutorials and I couldnt. It is becaming frustrating.

So you allow prices per user? Were it me I would have allowed them to add their own ingredients instead of using a public pool of ingredients if you allow users to change the price, then use row owners so they will only load their own rows.

Yes. I know but I cant launch ID per user. Maybe I need start the project from 0.

Can you specify why this is the case?

I am not sure why I cant. I can send you a video if you want

Please record a Loom video and give us the link in this thread.