RE: [PHP] creating a shopping cart.
[snip] What's the best approach to create a shopping cart.? [/snip] I see that you have received some answers already but I wanted to point out something very obviouslearn how to plan a software application. I know that I am old school, but I see far too many developers today winging it. A lot of the reason is that many languages now lend themselves to being self-taught, and while learning the language is great it is not the only thing a programmer needs to know about developing software. A basic flowchart could have helped you to answer your question and broken down the processes into their componenet parts. Heck, you don't even need fancy flowcharting software...just write down the steps. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating a shopping cart.
Jay Blanchard mailto:[EMAIL PROTECTED] on Monday, October 03, 2005 5:30 AM said: A basic flowchart could have helped you to answer your question and broken down the processes into their componenet parts. Heck, you don't even need fancy flowcharting software...just write down the steps. Believe it or not (you who have not actually used a flowchart for planning your code) you really *will* find flaws before you waste time coding. Another thing I've found is that it's not important to get hung up on what-shapes-do-what* in your flowchart. Just start making the chart and revising it as necessary, putting as much detail as you can. Chris. * Except for diamonds being logic gates (e.g. is the value hot or cold? yes/no), hotdogs being beginning and ending markers of a process/function/page, and squares being a process itself (e.g. add 5 to the variable). Having those in mind will help you keep things organized. You can later branch out into all the other shapes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] creating a shopping cart.
What's the best approach to create a shopping cart.? Cookies? Submit buttons passing _post values? Or create session values? I have a bit of code to get that started. It won,t be a complicated site: http://testesp.flsh.usherbrooke.ca/db/index.php - want to allow visitors check off the titles they want to store and then have a check out where I'll header it all into a txt file. session_name(ESLpostcard); session_start(); session_register(yourname); if (isset($HTTP_POST_VARS[yourname])) $yourname = $HTTP_POST_VARS[yourname]; -- John Taylor-Johnston - If it's not Open Source, it's Murphy's Law. ' ' 'Collège de Sherbrooke: ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/ - 819-569-2064 °v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures /(_)\ Université de Sherbrooke ^ ^ http://compcanlit.ca/ T: 819.569.2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a shopping cart.
Hi! The best way is already presented in PHP manual: http://www.php.net/oop . In this example you create an object, which you can - naturaly pass over Session, etc. If you'll use OOP (Object-Oriented Programming), it is preffered in PHP5 to use OOP5 (OOP for PHP5). You can find details on http://www.php.net/oop5 . Emil NOVAK, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a shopping cart.
you need a db based approach, just setup a couple of tables in mysql items table one record per item current cart table one record per each item added to cart with unique session id order table one record per each item ordered with unique order id you'll transfer records here from current cart when user checkout hope help adriano 2005/10/1, Emil Novak [EMAIL PROTECTED]: Hi! The best way is already presented in PHP manual: http://www.php.net/oop . In this example you create an object, which you can - naturaly pass over Session, etc. If you'll use OOP (Object-Oriented Programming), it is preffered in PHP5 to use OOP5 (OOP for PHP5). You can find details on http://www.php.net/oop5 . Emil NOVAK, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a shopping cart.
On Sat, 2005-10-01 at 09:31, Emil Novak wrote: Hi! The best way is already presented in PHP manual: http://www.php.net/oop . In this example you create an object, which you can - naturaly pass over Session, etc. If you'll use OOP (Object-Oriented Programming), it is preffered in PHP5 to use OOP5 (OOP for PHP5). You can find details on http://www.php.net/oop5 . While I would personally use OOP for a shopping cart, there is nothing that indicates it is the best way. Anything that can be done using objects can also be done procedurally using arrays. Additionally, PHP4 is quite sufficient for shopping carts versus necessarily moving to PHP5. There are already many many shopping cart solutions implemented in PHP4 thus PHP5 is obviously not a necessity even if it might be nice. What the originally poster needed to know was how to go about it, and yes the session is probably the route. The OP can also use permanent cookies if supported by the visitor to remember the visitor upon subsequent return, but this can also be facilitated with a login system for registered members. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a shopping cart.
On Sat, 2005-10-01 at 11:41, adriano ghezzi wrote: you need a db based approach, just setup a couple of tables in mysql items table one record per item current cart table one record per each item added to cart with unique session id order table one record per each item ordered with unique order id you'll transfer records here from current cart when user checkout A DB approach is nice, but not necessary. Serialization of a shopping cart array that contains the contents of the cart is sufficient. While a DB is a natural solution, I've heard of systems that use the file system or even email the request to a fulfillment address. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a shopping cart.
depends imho there are a lot of reasons to use a db approach, unless you are working on a really poor system, first is persistent in any case you'll never lost an item is the only way to make your software scalable to hundreds of users, using array you have everything in memory, you must set up your persistent system unless you trust a lot sessions that basically is a file on disk but as everything it's up to you I really suggest you to go on db I can't see any disadvantage bye 2005/10/1, Robert Cummings [EMAIL PROTECTED]: On Sat, 2005-10-01 at 11:41, adriano ghezzi wrote: you need a db based approach, just setup a couple of tables in mysql items table one record per item current cart table one record per each item added to cart with unique session id order table one record per each item ordered with unique order id you'll transfer records here from current cart when user checkout A DB approach is nice, but not necessary. Serialization of a shopping cart array that contains the contents of the cart is sufficient. While a DB is a natural solution, I've heard of systems that use the file system or even email the request to a fulfillment address. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php