473,246 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

Who here has done PHP shopping carts before?

I need a back-to-basics shopping cart tutorial in PHP/mySQL. I thought I
had it down and I failed, as usual. Here is what I mapped out as a spec:

3) initial work on bestilling.php to contain the following plan:

1) Cookie: 'nordicnet_bestilling' to contain unique, random 16-char string
2) Table: nnet_produkt_bestilling to contain ordering information bundled
by
unique bestilling_id (16-char string)
a) produkt_id
b) farge_id
c) storrelse_id
d) quantity ordered
e) bestilling_id
f) nordicnet_registration_number
3) *PROPOSAL* To make cookie a timed cookie - if user does not check out in
X hours
the cookie will be deleted
4) *PROPOSAL* CRON-based PHP script to systemically wipe out any stray rows
in
nnet_produkt_bestilling that have not yet been checked out
5) Idea plan for bestilling:
a) User will order produkt in vis_varegruppen.php
b) bestilling.php will do server-side checking of produkt, farge,
storrelse
and quantity based upon entry in nnet_produkt_farge_storrelse_assoc
c) bestilling.php will then check if $_COOKIE['nordicnet_bestilling']
already exists (meaning you have an order # - or, a cart ('bestill')
d) If you have a cart then check if there is already a row in
nnet_produkt_bestilling with same produkt_id/farge_id/storrelse_id with
your
matching bestilling_id
e) If so then increase quantity ordered by the quantity you ordered and
check
quantity totals against nnet_produkt_farge_storrelse_assoc
f) If NOT then add new row with produkt_id, farge_id, storrelse_id and
quantity with your bestilling_id and registration number
g) -- If you do NOT have a cart (no cookie) then generate a new cart
(bestilling)
id into a cookie
h) If other people ordered the same item be sure to check their quantities
ordered against yours and what is in stock before proceeding

So far this is what happens:

1) I enter products into the cart
2) If I delete items from the cart, they can be deleted; if I delete all
items from my cart, the cart cookie is deleted, I think.
3) I try to re-enter the same item into the cart, it inserts into the db w/
a NULL value for 'nnet_user_bestilling_id' which is
the cart id (which it's not supposed to do) and browser-side logic
fails, you get the wrong screen and all kinds of garbage I cannot even go
into because it's in Norwegian

I have tried for nearly 24 hours to build a cart and I can't seem to get it
done. I really need some help.

Phil
Jul 17 '05 #1
3 2699
RG

"Phil Powell" <so*****@erols.com> wrote in message
news:tuQdb.23441$sp2.13791@lakeread04...
I need a back-to-basics shopping cart tutorial in PHP/mySQL. I thought I
had it down and I failed, as usual. Here is what I mapped out as a spec:

3) initial work on bestilling.php to contain the following plan:

1) Cookie: 'nordicnet_bestilling' to contain unique, random 16-char string 2) Table: nnet_produkt_bestilling to contain ordering information bundled
by
unique bestilling_id (16-char string)
a) produkt_id
b) farge_id
c) storrelse_id
d) quantity ordered
e) bestilling_id
f) nordicnet_registration_number
3) *PROPOSAL* To make cookie a timed cookie - if user does not check out in X hours
the cookie will be deleted
4) *PROPOSAL* CRON-based PHP script to systemically wipe out any stray rows in
nnet_produkt_bestilling that have not yet been checked out
5) Idea plan for bestilling:
a) User will order produkt in vis_varegruppen.php
b) bestilling.php will do server-side checking of produkt, farge,
storrelse
and quantity based upon entry in nnet_produkt_farge_storrelse_assoc
c) bestilling.php will then check if $_COOKIE['nordicnet_bestilling']
already exists (meaning you have an order # - or, a cart ('bestill')
d) If you have a cart then check if there is already a row in
nnet_produkt_bestilling with same produkt_id/farge_id/storrelse_id with your
matching bestilling_id
e) If so then increase quantity ordered by the quantity you ordered and
check
quantity totals against nnet_produkt_farge_storrelse_assoc
f) If NOT then add new row with produkt_id, farge_id, storrelse_id and
quantity with your bestilling_id and registration number
g) -- If you do NOT have a cart (no cookie) then generate a new cart
(bestilling)
id into a cookie
h) If other people ordered the same item be sure to check their quantities ordered against yours and what is in stock before proceeding

So far this is what happens:

1) I enter products into the cart
2) If I delete items from the cart, they can be deleted; if I delete all
items from my cart, the cart cookie is deleted, I think.
3) I try to re-enter the same item into the cart, it inserts into the db w/ a NULL value for 'nnet_user_bestilling_id' which is
the cart id (which it's not supposed to do) and browser-side logic
fails, you get the wrong screen and all kinds of garbage I cannot even go
into because it's in Norwegian

I have tried for nearly 24 hours to build a cart and I can't seem to get it done. I really need some help.

Phil

http://shopbuilder.org
RG
Jul 17 '05 #2
Phil Powell wrote:
I need a back-to-basics shopping cart tutorial in PHP/mySQL. I thought I
had it down and I failed, as usual. Here is what I mapped out as a spec:
....
I have tried for nearly 24 hours to build a cart and I can't seem to get it
done. I really need some help.

Phil


The book PHP and MySQL Web Development by Luke Welling and Laura Thomson
contains a shopping cart example.

There are two editions. I have the first edition and it's pretty good. I
haven't built a shopping cart. I used the book for other things. I've
found that the code has a few errors and there were application design
decisions I wouldn't have chosen. So the learning experience will likely
include finding and fixing some errors, and I wouldn't uncritically
accept all of their architecture advice.

That said, it's a popular and well-written book.

Also, there have got to be some Free shopping cart implementations out
there. Have you tried sourceforge and stuff?

Phester

Jul 17 '05 #3
In article <FM********************@typhoon.sonic.net>, Phester wrote:
Phil Powell wrote:
I need a back-to-basics shopping cart tutorial in PHP/mySQL. I thought I
had it down and I failed, as usual. Here is what I mapped out as a spec:

Also, there have got to be some Free shopping cart implementations out
there. Have you tried sourceforge and stuff?


osCommerce works very well.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Bruneau | last post by:
Hi, I hope someone can help me make a working shopping cart, as a learning tool. If I have a "Product Demo" html page with a "Buy Me" button, there must be a simple javascript method of...
4
by: IntraRELY | last post by:
I want to gather some info on what everyone considers to be their favorite shopping cart...I am running VB/ASP.NET/SQL2000. TIA, Steve
0
by: Tulasi | last post by:
Hello, any one help me the problem due to Shopping cart. I am developping a project in that project,I want to connect shopping Carts in Vb.net.The shopping carts...
2
by: G.E.M.P | last post by:
High Level Session Handling Design for a Shopping cart 0) What am I missing? 1) How does OSCommerce do it? I'm thinking about building a shopping cart from scratch, using a library of dynamic...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.