Inventory cart products

when creating a custom cart & checkout, what is the best way to check for inventory without using any scripts.

I have an order’s table.
I filter these orders to only the ones that are Completed.
Using a multiple relation for every products in the products table I find the orders that contain that products and return an order summary text back to the products table showing the order details.

the text looks like this in the products table
example:
Product 1 (product1+5, product2+2, product3+1) if 1 order
Product 2 (product1+1, product2+1) (product2+5) (product2+8) if 3 orders

what is the best way to filter out how many Product1 were purchased and deduce that form the total inventory?

has anyone tried doing this for inventory? i tried also doing it the opposite way. relating the products table to the last order in checkout & if its complete deduce the value from the product inventory, but since a lot of the data is in user specific columns that didn’t work well at all.

1 Like

For each product you must have an initial availability. For each product you must set up a multiple relation towards the completed order rows of that product. Then in each product you will set a rollup column to sum the quantities. Current availability will be given from the initial inventory minus the sum found.

2 Likes

but how do you calculate when an order has multiple products in it. so there is no qty value for an order. the order can have qty 5 of product 1 & qty 10 of product 2. and there is loads of products

For the notes I wrote to you, I consider a scenario in which the order is explained in two tables: in the first table each row represents the header information of the order (the name of the customer, the date, the total of the order,… ), in the second table, the rows are related to the order header and contain product, quantity, price…
So, multiple rows order related to one order header.

For example copy this App. I wrote it with another purpose, but you can find here a simple structure with which you can manage any type of document which is composed of a header, a footer, and a body that contains all of its rows.

1 Like

Yes this is the normal scenario i would have used in a coded app, but cannot follow this scenario in Glide for multiple reasons:

  • mainly this requires so many unnecessary rows.
    An Order of 10 products will have 11 rows. Not to mention that if I want to duplicate rows in order to use row owners and secure order info that will require more rows.
    Imagine someone testing the app with random orders especially that you cannot delete orders automatically. the 500 row limit will be finished in hours.
  • when you are in shopping cart with multiple orders in cart & create an order, it is not possible with Glide to create multiple rows at once for all the order product details. (if those rows are created when a product is added to cart, that would be a huge exponential increase in row numbers as users can add delete multiple times before they decide what they want.

in my app every order comes with 1 row only. within that row there is a text description of the order details, i am looking for a way to split or manipulate this text which in order to get the product ID and QTY out of it.

i can also make the text in whatever format best suits the challenge above.

any string manipulation experts with advice? would highly appreciate

Well… this has been a long discussion since 2019: what is the best choice/procedure to create an own shopping cart avoiding using so many rows during the process?

Using the normal/regular way (what Roldy mentioned and Glide uses in its Buy button) lets you to have an easy structure and know your inventory without complications but on the way to that happiness too many rows are used and sacrificed. It isn’t efficient and I hated that way always!

When the Joined List was created it helped too much and allowed to create another shopping cart style (easier and smarter) but we still have some problems and one of them is what you are having: the inventory and sale stats based on product.

Unfortunately a Set Column action currently doesn’t support a multiple relation yet otherwise, I think we would have a final solution for this issue.

Saludos amigo!

3 Likes

I have the following text
a-G-ZDrg.QrKkaWD0VVxueQ+3, L6Ybx4HMSrKhaeIqjB0GIQ+1, TLQ8EH0zSRGD6.qiX0M.vA+5, a-G-ZDrg.QrKkaWD0VVxueQ+1, TLQ8EH0zSRGD6.qiX0M.vA+1

is there any possible way to find out how many times
Product ID: a-G-ZDrg.QrKkaWD0VVxueQ was purchased

the answer should return 4 which is the sum of these 2
a-G-ZDrg.QrKkaWD0VVxueQ+3
a-G-ZDrg.QrKkaWD0VVxueQ+1

1 Like

Currently glide has no native functions for manipulating strings that would surely allow you to achieve your goal. It is clear that you could use split column for commas and plus signs, but this would not be enough to get the sums you are looking for.
If others have experienced your case successfully it would be interesting to understand how.

1 Like