Before you start
This tutorial is for those interested in expanding the storefront created in "Create a Web storefront using PHP, Derby and PayPal, Part 1" and enhanced in Part 2 of this three-part series by integrating transactions, shipping, and e-mail functionality. This tutorial assumes knowledge of PHP, including PHP Data Objects (PDO) and user sessions, as covered in Part 1.
The staff at Ghastly Computers is excited about completing the storefront and putting it to use. This tutorial will cover the finishing touches -- mainly, adding the functionality to the storefront that will allow customers to ship purchased items to the proper destinations.
Part 1 focused on setting up a Derby database and creating the basic storefront. You will access Derby through PDO. User sessions are started to help set up for Part 2 where a shopping cart is associated with a user's session ID. The shopping cart is stored in the Derby database, and the user's session ID becomes the ID of the cart. The shopping cart, if it contains items, is shown under the listing of categories in the storefront. The cart displays Manage cart and Checkout links. Checking out involves taking a user's ship-to/bill-to information, which will be submitted for payment to PayPal. After completing the payment to PayPal, the user is then shown a Thank you page, and is given a new session ID.
Part 3 covers viewing orders, and notification for shipping and e-mail. Transactions using PDO will also be introduced. Adding shipping to the checkout process will be incorporated via UPS, offering real-time shipping prices. E-mail notification will be sent to the customer showing an order summary. PayPal, by default, also sends a payment confirmation e-mail messages to the user and the merchant.
This tutorial will add some finishing touches to the store application so the staff at Ghastly Computers can actually ship the products its customers are buying. You will start with an administration interface that will enable you to complete the order process (from the administration side). Then, on the user side, you'll add steps that will ensure that orders are correctly placed (by using transactions), add shipping costs and choices to our application (using UPS), and finally add the ability to send an e-mail to the customer when the transaction has been completed and the order has been shipped.
To follow along, you will need to install and test the following tools:
- Web server
- Pick any Web server and operating system. Feel free to use Apache V2.X, or the IBM HTTP Server.
- PHP
- Due to the use of PHP data objects, the latest version, PHP V5.1, is necessary to fully follow along in this tutorial. Note that V5.1 is is a release candidate (RC) and is not yet an official release. Be sure to configure PHP with the following option to include support for Derby:
--with-pdo-odbc=ibm-db2,/home/db2inst1/sqllib. See Resources for information about configuring Apache or the IBM HTTP Server with PHP. - Database
- This tutorial uses Derby. Download Derby V10.1, the current IBM DB2 JDBC Universal Driver, and the DB2® run-time client from IBM. Be sure to follow the instructions on each page carefully. Follow either the Linux® or Windows® instructions for downloading and installing the DB2 run-time client.
You may also use Cloudscape for this tutorial. The internals of Cloudscape are the same as Derby. However, the DB2 JDBC Universal Driver and other things are packaged into Cloudscape, and it is supported by IBM. Download Cloudscape V10.1, and the DB2 run-time client from IBM. - Java™
- Derby requires Java technology. I have found the gcj provided in Red Hat Linux distributions insufficient. Download Java technology from Sun.




