Zend Store
— print (last updated: Sep 17, 2009) print

Select font size:
Download the ZendStore.zip archive, extract it into the desired location and modify to suit your installation:
public/.htaccess     reset RewriteBase if necessary
public/index.php     replace '/usr/local/share/ZendLibrary' if necessary,
We will assume the existence of the guest user with empty password. We also assume the MySQL root user has no password — if so, make the appropriate modifications. We will also assume that the projects are accessible as the "/default" URL.

This application assumes you're using the dedicated MySQL zendstore database. To set up the database and the initial tables, run:
mysql -u root database.sql
mysql -u guest zendstore tables.sql
Afterwards, you should be able to access the project via the URL:
http://localhost/default/ZendStore
You can see a working version from this link on the Computer Science server:
http://www.cs.wcupa.edu/~rkline/ZendStore

Database

The database has four tables. The standard, primary key, integer id field is present in each, but not shown:
products:
 description TEXT
 price DECIMAL(9,2)
 
 
admins:
 username VARCHAR(50)
 password VARCHAR(50)
 UNIQUE (username)
 
shoppers:
 username VARCHAR(50)
 password VARCHAR(50)
 email VARCHAR(50)
 UNIQUE (username)
orders:
 shopper_id INT
 created DATETIME
 
 
items:
 order_id INT
 product_id INT
 qty INT
 price DECIMAL(9,2)
The primitive entities are products, shoppers and admins. The "derived" data appears in the orders and items tables which contain foreign keys. The naming of foreign keys is consistently presented as
table-row-name_id
where table-row-name is the table name (always plural) made singular. In particular, an order is reflected as an entry in the orders table made by a shopper (shopper_id) at a certain time (created). The order consists of one or more items represented in the items table where each item:

Description

This is an online store application which is incomplete. but the code therein suggests what needs to be done. The key of the idea is that we want to allow: Anyone using this application can create an cart, but to turn this cart into an order, the user must be a registered shopper in the sense of having an entry in the shoppers table. Anyone has the ability to do so, and we omit the usual acquisition of personal information which is usually necessary to turn oneself from an anonymous user into a full-fledged shopper.

The shopper, in order to create an order must "log in", at which point he/she has the ability to see the his/her "pending" orders.

On the other side is the administrator whose primary job is to process the orders of all users as they come in. In this simplistic setting, processing an order simply means to delete it.

Controllers

The ValidateController and My_Helper classes are not shown; they are identical to that used in ZendBooksAuth application.

IndexController

This manages the creation of the user "cart", similar to what is done in ZendBooks

( click to show )

OrderController

A user must log in as a valid "shopper" to use the features here. It allows users to place an order from an existing cart or see his "pending" orders.

( click to show )

ShopperController

This allows a user to create a "shopper identity" with username and password.

( click to show )

AdminController

This allows administrative users (admins) to "process orders" by deleting them and make changes to existing products (like increase the price).

( click to show )


© Robert M. Kline