Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cart with text file as a database

Status
Not open for further replies.
Mar 16, 2006
66
CA
Hi
I would like to make shopping cart
I do not want to have a database,like acces
I would like to use a text file to store my data
Are there ready products like this on the market
 
A shopping cart is one element of a e-commerce system which is too complex to rely on text files. I don't know of any products on the market that don't use a database.

BDC.
 
Hi people !

A university student was saying that he could make such a web site.
This is what he claimed.
Wheter he could or he could not is something we wont know.
Thanks
 
I use simple text files from time to time for ecommerce site data files, too, if a web host server doesn't provide a database to use. So it's possible to use a text file as a data file for an ecommerce site, and not too difficult to design a shopping cart for from scratch, either. If you want something already made, you'll have to do a search to see what matches your criteria, though.

Lee
 
Yes you could certainly do it with a text file but it really is not a good idea. Many web hosts provide access to a database on their system. It would be a lot better in the long run and the learning curve between using the database would actually be shorter than learning to manipulate txt files in the ways you would need to for a commerce site.

Remember that you will need a way to uniquely ID every visitor to the site in order to keep track of what they have in their cart. To do it in one file would be very slow to parse through a specific clients data if there were a lot of users online and your ability to modify the txt file is VERY limited. You would essentially be re-writing the file every time a change was made. And if you use separate files for each visitor then you could end up with a LOT of files in your web folders and have to have routines to take care of cleaning them up.

If you really do not want to deal with a database you might be better off storing the info in a cookie on the client's PC.


It's hard to think outside the box when I'm trapped in a cubicle.
 
Hi theniteowl !

First I would like to say that Birds are very special.
I am a bird watcher.
These animals are smart.
Anyway.
What you are saying about text files makes a lot of sense.
The only way to know is to try.
Thanks
 
theniteowl, all that you described is quite different from the techniques I've used. The item data is stored in a sequential text file, orders are stored in a separate sequential text file, and customer choices at the site are handled with sesson variables (which are cookies, I know) until the checkout is processed. It's more of a roll-your-own database, and you don't use SQL to make queries. While it might be easier to learn to use a database, I've run across several small web hosts who don't have a database engine installed, so that wasn't an option.

Lee
 
Yes but the question was about the cart specifically which would mean a text file for each visitor and cleanup when done or some timed event expires. Or it would mean one large text file with all visitors info that would need frequent updating to add/remove/expire data. You cannot just delete lines from the middle so the whole file has to be re-written. Appending to the end is easy but the rest is very time consuming and parsing out the file looking for info specific to one client could get really slow.
The cookies would be much faster. Session variables would work but excessive use of them kills performance on the server (unless that has changed with recent updates?).

Remember, my response was solely to the use of text files for a shopping cart, not related to relatively static information like available products or posted order information.
I do not have a problem with the use of txt files I was just pointing out that if the reason to use them was due to an unfamiliarity database systems then the special considerations required for dealing with txt files could easily outweigh the effort involved in putting together a database driven system especially when you find needs to go in and report on your data in different ways and just do not have the flexibility.

If a database were not available or even a possibility then a spreadsheet file would be a little more beneficial as you could more readily manipulate and organize the data.

I use text files to drive a PHP menu system on a school web site as they did not have a database available. But usage like that is easy because the file is small and very infrequently altered.


It's hard to think outside the box when I'm trapped in a cubicle.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top