Posted by Pro N00b on 10/01/72 11:13
darkjedi26@gmail.com wrote:
> I'm going to be putting up a web page where I'll be selling products
> that I only have 1 of. I'm trying to find some kind of script or
> something somewhere that will track the inventory for me so that when
> someone buys something, someone else wont be able to buy it again. It
> will show inventory 0 or sold out or something.
>
> I dont need a whole shopping cart system, just something really simple
> to count down the inventory from 1 to 0.
>
> Anyone have any ideas or know of anything?
Expecting that you already have a webshop script:
add a field in your database named `quantity`, and when someone buys
something, execute
UPDATE `products` SET `quantity` = `quantity`-1
WHERE [something that matches your product]
When listing the products, you can easily hide the sold-out products by
adding '`quantity` > 0' to your WHERE.
Hope you can do something with this.
[Back to original message]
|