Share this Page URL
Help

Chapter 25. Selling Stuff Online > The Do-It-Yourself Method: Selling Stuff fro... - Pg. 285

Selling Stuff Online 285 Figure 25.4. The bottom part of the order form. The order form is in a file named orderfrm.htm on the CD in this book. There are two things you need to know right up front before you can think about customizing this file to suit your own site: · The product list and ordering boxes are arranged in a table that's written automatically to the page using JavaScript. The item names and prices can be customized. · The rest of the order form is a basic HTML table that you can modify at will. So the only bit of funny business here involves customizing the "database" of products. This is done as part of the script that sites near the top of the file. Here's the code that creates the database of products shown in Figure 25.1: // Create the "database" of products var database_records = new Array() var i = 0 database_records[i++] = new database_record("ACME database_records[i++] = new database_record("ACME database_records[i++] = new database_record("ACME database_records[i++] = new database_record("ACME database_records[i++] = new database_record("ACME Birdseed", 4.99) Giant Rubber Band", 9.99) Earthquake Pills", 19.99) Jet-Powered Sneakers", 39.99) Rocket Sled", 149.99) What's happening here is that you're storing some data about each product in the computer's mem- ory. The key here is each line that begins database_records[i++]. Here's the general format of this statement: database_records[i++] = new database_record("Product Name", Price) Here, you replace Product Name with the name or short description of the product, and you replace Price with the item's price (don't include a dollar sign or any other monetary symbol). Processing the Orders