Hello guys,
I need help in my school project, I followed a tutorial in youtube in making a food ordering app, and then I converted that food ordering app to a water ordering app. My problem however is that the food ordering app I followed has no inventory management system. So I am adding an inventory management system because it is required in my school project. My problem now is how do I reduce the (product) stock after the user has placed his order the system calculates the total price, but I need to reduce the product stock.
This is how he calculates the total price from the cart.
https://pastebin.com/3QM9G5Ly
These are my model
https://pastebin.com/yA7c0FU1
I need to subtract the amount ( from the cart) in the product stock in order for me to complete the Ordering capability of the system. Thank you very much for your help!
I am thinking about using this
Code:
int stock = Integer.parseInt(Product.getQuantity(GET PRODUCT ID FROM USER CART) - Integer.parseInt(Order.getQuantity());
and then update the stock in product table in my firebase database.
here is my firebase database
[IMG]https://i.stack.imgur.com/E14Qp.png[/IMG]