Page 1 of 1
Implementation of a shopping cart in PHP
Posted: Fri Jan 23, 2004 8:59 am
by dimitris
Can anyone explain to me how an electronic shopping cart could be implementated in PHP?
My first thought was to use a mysql database to store the orders!But this could overrun the database and i should have a proper control mechanism!
My second thought is a session array which would store ids of things which someone selects in through some pages!
I am a newbie in PHP and e-commerce techniques so any help would be very helpful to me!

Posted: Sat Jan 24, 2004 1:07 am
by McGruff
There's no problem using a db to store orders. Just clear out the old orders once in a while - either delete them or save as historical data somewhere.
Have a hunt around for some shopping cart tutorials and then see what you can come up with. If you have a problem with a specific script or php function, post in the Code forum. If it's more of a theory/design quesion post here.
Posted: Sat Jan 24, 2004 5:28 am
by dimitris
Ok!I look for some tutorials but i wanted to have a clear view how a market cart works!
I mean i store all orders in a db but I am not sure what to do with them while the user has not verify them!
Posted: Sat Jan 24, 2004 5:53 am
by McGruff
The answer to "how do I design a shoppng cart?" is really "how do you want to design it?".
You can store data in databases or files (databases preferred) and (temporarily) in sessions.
My best advice is that I think you ought to read up a bit more but I'll be glad to help when you've done that and have some specific questions.
If it's for a live site, you must have a thorough understanding of security issues relating to php, sql, etc. Except as an exercise, ecommerce systems are not something a beginner should attempt.
Posted: Sat Jan 24, 2004 7:22 am
by dimitris
McGruff wrote:
If it's for a live site, you must have a thorough understanding of security issues relating to php, sql, etc. Except as an exercise, ecommerce systems are not something a beginner should attempt.
Yes, it is for a live site and i try to do my best in order to understand sessions and other issues!Security is a thing i consider most.
Actually,I have implemented a login script and many of the pages that someone can view and choose products but i must think more about the market process!
I'll come up soon!
Thanks

Posted: Sat Jan 24, 2004 12:59 pm
by McGruff
dimitris wrote:
Yes, it is for a live site and i try to do my best in order to understand sessions and other issues!Security is a thing i consider most.
Don't do it.
You obviously don't have the required knowledge going by the comments you made about databases and the fact that you are asking questions on a php forum. Do you know anything at all about security?
If it's your own business think of the damage that could be done if the site gets hacked and some cc numbers are stolen. If you're doing it for a client, think of the damage it could do to your reputation as a programmer.
Script kiddies getting in over their head on an ecommerce project are bad for the reputation of the internet as a secure place to do business
I'm telling you this for your own good.
Posted: Sun Jan 25, 2004 1:46 am
by JPlush76
I agree with McGruff
sounds like you're getting in over your head really fast. Its great to learn, but when you're learning at the expense of real people's credit card numbers thats a bad thing.
Pass the project to someone else, take a cut of it and get yourself some knowledge on the subject.
There are so many aspects when creating an e-commerce store. I created one from scratch with PHP that has done over 4 million last year so I speak from experience.
Posted: Sun Jan 25, 2004 3:43 am
by patrikG
I agree with McGruff and JPlush (hey, for once, J

). If you are a newbie to web-technolgies and PHP, the issues are simply too complex.
For step-by-step tutorial to shopping carts I would recommend "MySQL/PHP Database Applications" by Jay Greenspan and Brad Bulger.
Write an online shop that handles orders via email, i.e. once an order is placed an email gets sent to the supplier/owner of the shop.
Don't ask for credit card details. Let the supplier/owner handle that on receipt of that order-email.
All you'll be processing is product details - no payment methods or anything else.
So strictly speaking: start off with an online ordering application. That will give you enough to do for a bit and you'll learn much more about PHP and web technologies.
However, do
not even dream about integrating credit cards into that ordering system. That would be like asking around for a third party to grab the card details.
Posted: Sun Jan 25, 2004 7:09 am
by McGruff
I was trying to say one thing clearly back there but, of course, I don't want to discourage you learning php. I hope you do stick at it and one day learn enough to write the mother of all shopping carts.
Posted: Sun Jan 25, 2004 11:10 am
by dimitris
I agree with you guys that it is too risky for a newbie in php to implement an e-shop with cc !
In this situation i just want to implement it as an online order system where orders will be validated with phone calls and the payment will be via post or check or when the customer receives his packet!
Thank you all for your advice! As i said i'm doing my best!

Posted: Sun Jan 25, 2004 11:51 am
by JPlush76
dimitris, that sounds like a really good start to e-commerce. Credit cards are the trickiest part of any shopping system.
http://www.zend.com has a good tutorial on starting a shopping cart
Posted: Mon Jan 26, 2004 7:59 am
by dimitris
JPlush76 wrote:dimitris, that sounds like a really good start to e-commerce. Credit cards are the trickiest part of any shopping system.
http://www.zend.com has a good tutorial on starting a shopping cart
Thaks a lot! I'll see it at once!

Posted: Mon Jan 26, 2004 8:09 am
by d3ad1ysp0rk
Can anyone point me towards a good tutorial on PHP and databases? Currently I just make sure register_globals is off..
Posted: Mon Jan 26, 2004 8:14 am
by dimitris
By the way, dimitris in Greek equals to jim in english!
I find some good tutorials which look quite helpful
Posted: Mon Jan 26, 2004 12:22 pm
by dimitris
LiLpunkSkateR wrote:Can anyone point me towards a good tutorial on PHP and databases? Currently I just make sure register_globals is off..
There are a lot of good tutorials at:
http://hotwired.lycos.com/webmonkey
http://www.phpfreaks.com
http://www.freewebmasterhelp.com
http://www.php.net/tut.php
try some of them for a start!
P.S. I think that this question applies better to Code section!