Page 1 of 1

shopping cart functions

Posted: Fri May 02, 2003 6:04 pm
by Swede78
I'm attempting to build a shopping cart. I'd prefer to be able to use a working script, rather than build one from scratch. However, all I can find are scripts that include the entire e-commerce package, or general descriptions of how a shopping cart works, without any code examples.

I know exactly what I want to do, but I'm having trouble writing it in PHP. I want to build a cart that allows anonymous users to add, remove, update and view items in a shopping cart via Sessions. After their first order is complete, subsequent orders could be made quicker using a login. If possible, I'd like to allow logged in users to store their items in a database. I don't know how practical it is to have 2 methods of storing shopping cart information. The point is to reduce database junk overload from "window shopping". If anyone has found a good way to overcome this, please post your suggestions.

So, basically, I'm looking for shopping cart functions that work as described above. I don't need an entire ecommerce package, just the cart. If anyone knows of a good place to find sample code, please let me know.

I bought a book called "PHP and MySQL Web Development" which has a section on shopping carts. However, the sample code doesn't work. I just get a blank page when I view the "view cart" page. If anyone's interested, I'd gladly email the sample cart pages to see if you can get them to work. Or I could paste the pages in here, but there's quite a lot.

I know this is a very general question. I've been searching for days now, and I just can't seem to get this going. Every example I find is done in a different way, and I'm just getting more and more lost. The big ecommerce packages are too overkill. I already have a layout for my site, and pages that browse my inventory. And I'm not worried about creating administration pages. I'm basically getting stuck while trying to work with items in the cart (adding, deleting and updating).

Thank you for any suggestions in advance.

I'm building my site on a Windows 2000 server, with PHP 4.3.1 and MySQL 3.23.56.