Cart php quantity

Asked

Viewed 264 times

1

I have a cart made in php and the products are in the database, as I do to put a restriction on in a particular product for example: Product number four in my database, I want it to be only 100. Thank you who can help.

  • Do you want this restriction on the business layer, stock bank or both?

  • The products of the cart are placed there by the id of the database, I want this restriction by id for when calculating the freight by the web service of the post office, did you understand? Thank you

  • And why doesn’t Voce create a field in the table for the limits of each product? For example, product id= 4 - limit 100, product id= 5 - limit 200?

  • It had not thought to put the limit good idea I will test, I already managed to make the comparisons of the boxes really worth to all, now it remains to put the limit in the quantity of each product. Thank you all!

1 answer

0


You can do this via software, create a field with the amount of each product and its maximum in the database.

When you go to make the queries, do a bank search and check if the limit has already been reached and have the necessary control.

Another way is to do a procedure in your database to be executed before each Insert. If the table has availability, it inserts. Otherwise, send a warning and do not insert. It depends on the database, but usually this can be done using PL/SQL.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.