473,786 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_best illing' to contain unique, random 16-char string
2) Table: nnet_produkt_be stilling 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_regis tration_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_be stilling 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_fa rge_storrelse_a ssoc
c) bestilling.php will then check if $_COOKIE['nordicnet_best illing']
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_be stilling 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_fa rge_storrelse_a ssoc
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_best illing_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 2719
RG

"Phil Powell" <so*****@erols. com> wrote in message
news:tuQdb.2344 1$sp2.13791@lak eread04...
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_best illing' to contain unique, random 16-char string 2) Table: nnet_produkt_be stilling 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_regis tration_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_be stilling 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_fa rge_storrelse_a ssoc
c) bestilling.php will then check if $_COOKIE['nordicnet_best illing']
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_be stilling 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_fa rge_storrelse_a ssoc
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_best illing_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************ ********@typhoo n.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
3318
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 storing the necessary product information. There could be several fields involved... Then there ought to be another javascript method that can create a new document based on the list a user has built selecting product from several
4
1681
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
1239
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 like(www.oscommerce.com),(www.miva.com) and Yahoo! Stores.And Retrievs the Shopping cart Coustmer information and Product information Etc. how it is connected?How the information is retrived those Shopping cart? What is the procedure to connecect those Shopping Carts?Any one to...
2
2301
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 screen generation routines (already written) that take an XML stream as input from various "search for products" forms. That way I can run queries in one window and display the dynamic results in another. The searching functions will probably
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10104
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.