HomePHP Page 9 - Building an E-Commerce Site Part 3: Catalogs and Shopping Carts
Step 2: Extracting the New Scripts - PHP
This is the third and final article in a three-part series dealing with using PHP 4 and MySQL to make a comprehensive e-commerce storefront solution. This article covers the shopping cart, payment processing, and database engine considerations, among many other topics. Full source code included!
Okay, we've got our user table, let's make screens for the user to log in and log out. Download the mymarket3.tar.gz file and extract it into your web root directory. Note that this replaces the files from the first tutorial.
IMPORTANT NOTE: If you have made modifications to the files from the first tutorial, please make a backup copy and store it somewhere else. The files in mymarket3.tar.gz will overwrite any changes you made to the files from the first tutorial.
If you have made modifications to the files from the first tutorial, please make a backup copy and store it somewhere else. The files in will overwrite any changes you made to the files from the first tutorial.
We do the same drill from the first and second tutorial. Download the mymarket3.tar.gz file and extract it into your web root directory. For example, if your web root is in
/home/httpd/html
type
$ cd /home/httpd/html
$ tar -zxf /tmp/mymarket3.tar.gz
Assuming that you've downloaded mymarket3.tar.gz into /tmp. Now, open up the file application.php and change the $CFG->wwwroot and $CFG->dirroot paths to match your server configuration.
Directory Structure
You should already be familiar with the contents of the mymarket directory, looking carefully, you will see a new directory called shopping.
drwxrws--- 3 apache web 1024 Jun 1 08:46 admin/
drwxrws--- 2 apache web 1024 Jun 1 02:05 images/
drwxrws--- 2 apache web 1024 Jun 1 09:18 lib/ drwxrws--- 2 apache web 1024 Jun 1 09:18 shopping drwxrws--- 3 apache web 1024 Jun 1 11:20 templates/
drwxrws--- 3 apache web 1024 Jun 1 11:20 users/ -rw-rw---- 1 apache web 2074 Jun 1 14:58 application.php
-rw-rw---- 1 apache web 1488 Jun 1 12:21 index.php -rw-rw---- 1 apache web 2427 Jun 1 14:51 login.php
-rw-rw---- 1 apache web 1040 Jun 1 11:19 logout.php
The shopping directory contains all the scripts that have to do with displaying the product catalog, viewing product details, the shopping cart, and purchasing. That is where most of the new scripts reside. We will now go over the script changes.