Professional Documents
Culture Documents
Vino Temp
Vino Temp
Dr. Sun
Table of Content
1. INTRODUCTION................................................................................................1
2. TECHNOLOGICAL BACKGROUND........................................................1
3. SYSTEM ANALYSIS & DESIGN..................................................................2
3.1
USE CASES..........................................................................................................2
3.1.1
Customer Interface.....................................................................................3
3.1.2
Admin Interface..........................................................................................5
3.2
SEQUENCE DIAGRAMS.......................................................................................7
3.2.1
Customer Interface.....................................................................................7
3.2.2
Admin Interface..........................................................................................8
3.3
WEBPAGE DIAGRAMS........................................................................................9
3.3.1
A general diagram of the Customer Side...................................................9
3.3.2
A general diagram of the Admin Side......................................................11
WEB PAGE......................................................................................................................11
4. IMPLEMENTATION DETAIL.....................................................................11
4.1
ADMIN SIDE......................................................................................................12
4.1.1
Create Username & Password.................................................................12
4.1.2
Login.........................................................................................................12
4.1.3
Delete items...............................................................................................12
4.1.4
Modify items..............................................................................................12
4.1.5
Query Sale.................................................................................................12
4.1.6
Query Information....................................................................................12
4.1.7
Logout.......................................................................................................13
4.2
CUSTOMER SIDE...............................................................................................13
4.2.1
Categories are selected.............................................................................13
4.2.2
Search Products........................................................................................13
4.2.3
Buy Items..................................................................................................13
4.2.4
Continue Shopping...................................................................................13
4.2.5
View Cart...................................................................................................13
4.2.6
Change Quantity (in View Cart page)......................................................13
4.2.7
Remove Items............................................................................................13
4.2.8
Checkout...................................................................................................13
4.2.10
Sign-in.......................................................................................................13
4.2.11
Billing/Shipping Information..................................................................13
4.2.12
Change (in Bill/Ship Information page).................................................14
4.2.13
Submit (in Bill/Ship Information page)..................................................14
4.2.14
Delete Order (in Confirm page)...............................................................14
4.2.15
Send Order (in Confirm page).................................................................14
5. CONCLUSION....................................................................................................14
7. FUTURE WORK................................................................................................15
II
WORKS CITED..............................................................................................................16
APPENDIX A...............................................................................................................17
APPENDIX B...............................................................................................................19
III
1. Introduction
The main goal of this project was to create a shopping cart, which allows customers to
shop and purchase the Vinotemp products online. Moreover, the project is also designed
in such a way it lets managers manage the products information online.
The Vinotemp online store sells wine cellars. Customers can orders products, and they
will be contacted to further process the orders.
2. Technological Background
The tools used to develop the shopping cart include:
- PHP scripting language
- MySQL database server
- Apache server
- HTML
- Text Editor
PHP is a server side scripting language designed specially for the Web. Within an HTML
page, PHP code can be embedded and it will be executed each time the page is visited.
PHP is an Open Source product. PHP source code can be accessed, used, altered, and
redistributed without any charges.
MySQL is a very fast, robust, relational database management system (RDBMS). A
database enables the users to efficiently store, search, sort, and retrieve data.
1
Apache server interprets the PHP code at the Web server and generates HTML or other
output that the visitor will see.
Text editor such as Textpad is used to write the coding in plain text that the Web server
can recognize and translate into binary code.
There are advantages of using these tools to develop and run the software. Apache
server, MySQL server, and PHP are free to download from the internet if one does not
have any tools.
3.1
Use Cases
The following use cases outline the requirements for the online shopping.
They have been revised during the course of the project to more accurately reflect the
system.
3.1.1
Customer Interface
R e m o v e Ite m
V iew
B ro w se
P r o d u c ts
C art
A d d Ite m
C h an g e
Q u an tity
S e a r c h Ite m s
C h eck o u t
C u s to m e r
B i l l /S h i p
C o n fi r m
S en d O r d er
The customer starts this action by typing a query into a text box named
description to search for description of an item. The page sends a message to the
server asking for a listing of products, whose names match the query, from the
database. The action is complete when a page is returned for the customer to
view, which contains a list of the resulting products along with their picture,
price, and an option to add the product to the shopping cart. If a given description
doesnt match with any descriptions in the database, a message indicating such is
displayed instead of the option to add to cart. The customer can also search for an
item using model number or combination of both description and model.
3. Customer adds an item
The customer initiates this action by clicking on the buy button on the right side
of to a products listing. An item is added to the cart including the price and
displayed with the total price. If the product already exists in the customers cart,
its quantity is increased by 1. There is a Continue Shopping button for the
customer to continuing shopping for other products.
4. Customer views cart
The customer initiates this action by clicking on the view cart button, available on
any webpage. The page sends message to the server and shows a list of all
products in the customers cart, along with their quantity and total price.
5. Customer removes item from cart
The customer starts this action by clicking on the Remove button on the view cart
page. The web page sends a message to the server, which removes the product
from the customers shopping cart.
6. Customer changes quantity from cart
The customer starts this action by changing the quantity of the item and clicking
on the Change button on the view cart page. The web page sends a message to the
server, which updating the product from the customers shopping cart.
7. Customer checks out
The customer starts this action by click on checkout button the on the view cart
page. A check out page is displayed letting the customer to create a new account
4
Admin Interface
In s e r t It e m s
L o g i n
D e l e t e It e m
o d i fy It e m
A d m in
Q u e r y
In fo r m a t i o n
1. Admin logs in
The admin starts this action by inputting the username and password and clicking
on the submit button. The page is sent the message to the server to validate the
information from the database. After successful validation, the logged in page is
returned with options for the admin to add, modify, or delete products, or query
information.
1. Admin inserts item
The admin starts this action by clicking the Input Items button from the logged in
page. The page is displayed with a form for the admin to insert item and its
details. Once Insert button is clicked, the web page sends this information to the
server, which in turns stores it in the database.
2. Admin removes item
The admin starts this action by clicking on the Remove Items button. The web
page is displayed a drop down menu for the admin to send the item he/she wants
to delete. Once, delete button is clicked, the page is send message to the server
which in turns tells the database to remove the item
3. Admin modifies item
The admin starts this action by clicking on the Modify Items button. The web
page is displayed a list available products from the database. The admin then
chooses the item he/she wants to modify by clicking on particular item. A page is
displayed letting the admin to modify all item information, except its UPC code
and model name. Once, the Modify button is clicked, the web page sends a
message to the server, which updating the information from the database.
4. Admin queries information
The admin starts this action by clicking on the Query Sales button. The web page
is displayed, allowing the admin query by period model, or order ID for the sales
information. Once, Query button is clicked, the page is sent message to the server
which in turns requests all sales that match the query from the database.
3.2
Sequence Diagrams
The next step is to develop scenarios through sequence diagrams. The sequence diagram
below outlines the requirements for online shopping
3.2.1
Customer Interface
B ack E nd
F ro nt E nd
D B
S e le c t P ro d u c ts
Q u e ry P ro d u c ts
D is p lay P ro d u c ts
B u y Ite m s
S ho w C art
C h an g e /R e m o ve Q u a n ity
U p d a te C a r t
V ie w C art
D is p lay C art D e tails
C o n tin u e S h o p p in g
D is p la y P ro d u c ts
C heck o ut
D is p lay F o rm
C re a te a n A c c o u n t
C h e c k va lid ty
In v a lid
S ig n In
C h e c k V a lid ity
S h o w B ill/S h ip F o rm
In p u t B illin g /S h ip p in g F o r m
S h o w C o n firm O rd e r
S e nd O rde r
S to r e In f o r m a tio n
S e n d C o m firm E m a il
DB : database server
3.2.2
Admin Interface
F ro n t E n d
Back End
D B
L o g in
C h e c k v a lid ty
V a lid
I n p u t it e m
I n p u t in t o t a b le
B a c k to fo rm
D e le t e / M o d if y I t e m
D e le t e / O v e r w r it e I t e m
B a c k to fo rm
Q u e r y S a le s / I n f o r m a t io n
C o m p a re
D is p la y R e s u lt s
Log O ut
D is p la y L o g I n P a g e
DB : database server
3.3
Webpage Diagrams
3.3.1
categories.php
add_to_cart.php
Search
Buy
continue
shopping
Check_out.php
Check
out
A link to
categories.
php after
order is
sent
bill_ship_infor.php
create
account
Billing
Valid in
Shipping
in v
in fo rm a a li d
tio n
sign in
n
formatio
submit
in
valid
check_bill_ship_infor.php
a
form
tion
confirm.php
change
send
order
delete
order
in f
d is
p
n la
o rm e w y
a ti
on
submit
Link :
Button:
Web page:
submit
confirm.php
10
3.3.2
Delete
Query Sale
Main
Delete
Modify
Query Table
Shopping
Logout
Link:
Web page
Like Customers webpages, this diagram represents a general look of the admin side
through webpages. After logging in, an administrator can input item, delete item, modify
item, or query information from the database.
4. Implementation Detail
In the Admin and Customer side, for each feature (e.g. feature Create Username &
Password in Admin side), there are classes function(s) or PHP codes in web pages
involving to process the requests from users or display the results on the web pages. The
descriptions of the classes functions are in the Appendix A.
11
4.1
Admin side
4.1.1
4.1.2
4.1.3
Login
main(): validate the username and password (in check_userpass.php)
Delete items
The PHP codes in the delete_item2.php page are used to delete the item selected
from database and update database.
4.1.4
Modify items
The PHP codes in the queryTable3.php page are used to display the selected item
to be modify on the web page.
The new input data is validated by using the PHP codes in the validate_Input.php
page.
If it is valid, the modified item data is stored in database by using the PHP codes
in the make_change_item2.php page.
4.1.5
Query Sale
validate_from_to() in the query_sales.php page is used to validate the time , from
and to.
4.1.6
Query Information
Functions get_customer(), get_order_detail(), get_order_main(), or
get_inventory() in the query_infor_page.php page is used to query the data from a
table in the database and display the data on the webpage for viewing.
4.1.7
Logout
The PHP codes in the login_admin.php page is used to unset the username and
password session variables.
12
4.2
Customer side
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8
Checkout
4.2.9
displayForm()
Create an Account (in Checkout form)
validateNewUser(), insertNewUserData()
4.2.10 Sign-in
validateSignIn()
13
printItemsConfirm()
4.4
Database
Tables:
cat1_cat2
cat1_cat2_cat3
cat2_cat3
category
category_List
inventory
customers
order_detail
order_main
sale
(See Appendix B for more details)
5. Conclusion
The application is working well so far, and it is easy to install and use. However, feature
such as Modify Item in the Admin side is still not working friendly. It asks users to rebrowse the image and the manual for the item to be modified. This feature will be fixed
in the future works. More designs and decorations should be added to the web pages to
make them more attractive.
7. Future Work
14
I will fix bugs if they are found. More features will be added into this application. For
example, payment methods such as Pay Pal or credit cards will be available on this online
store. The future works also enables users to customize features. Moreover, objectoriented approach will be applied through out the application.
Works Cited
15
Achour, Mehdi, Friedhelm Betz, Antony Dovgal, et al. PHP Manual. PHP Online
Manual. The PHP Group. 15 January 2005
<http://us3.php.net/manual/en/index.php>.
Argerich , Choi, et al. Professional PHP 4. Birmingham: Wrox Press Ltd, 2002.
Satzinger John W., Tore U. Orvik, The Object-Oriented Approach: Concepts, System
Development, and Modeling with UML
Wyke, R. Allen, Michael J. Walker, and Robert M. Cox. PHP Developers Dictionary.
Indianapolis: SAMS, 2001.
Appendix A
16
17
- display_cat1_cat2($cate1, $cate2): There are two parameters are passed, the first and
second selected categories. It queries data from database and prints out the first and the
second category list of items. If the third category is already selected and stored in the
HTTP_SESSION_VARS, all three categories lists are displayed.
- printSelectedCategories($view_items): An array containing selected categories
which are printed in the header content (above the main content part of the page). This is
to help customers view the selected categories clearer.
- displayLinks($links): An array parameter is passed. This parameter containing a list of
link pages, which are displayed in the sidebar part of the webpage.
- printSearchBox(): It prints out description and model search boxes in the sidebar
part on the left most of the webpage.
class Template_Functions
- pageHeader(String): it passes a string which is the title of the webpage. It prints out
the first line of a HTML page (e.g. "<!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN "http://www.w3.org/TR/html4/loose.dtd">) , and
<html> , <head>, <title>, <meta>, <link>, and <body> tag elements.
- pageFooter(): it prints out the line <body></html> to close the HTML webpage.
- connectDatabase(): it is called to connect database. If the connecting database is not
successful, an error message will be printed out.
- headerArea($bold, $button_arr): it is called to print out the links and the phases in
the header area of the webpage while a customer is shopping online. The links
Continue Shopping, View Cart, and Check Out. The phases include Shopping,
Billing, Checkout, and Confirm. These phases are used to remind customers that
where they are during they are shopping.
- upperSidebar(): it is a template function called to print out a HTML source code in
the upper sidebar area. The line it prints is "<table><tr> <rowspan=\"2\">
<div class=\"sidebar\"> <table
background=\"images/side_bar.jpg\width=\"250\" height=\"1000\"><td
valign=\"top\">");
- lowerSidebar():it is a template function and prints out a HTML source code in the
lower sidebar area (see appendix for the function implementation).
- upperContentHeader(): it is a template function and prints out a HTML source code
(see appendix for the function implementation).
- lowerContentHeader(): it is a template function and prints out a HTML source code
(see appendix for the function implementation).
- upperContent(): it is a template function and prints out a HTML source code
lowerContent(): it is a template function and prints out a HTML source code.
class Order_History
- signInForm($main_arr): It prints out a form for customers to sign in to request their
order history.
- displayOrderHistory($main_arr): An array containing data used to connect database
and query data from database. An order history page of the specific customer is
displayed.
18
class Product_Listing
- calculateProductListing(): This functions calculates numbers of pages, and rows,
start, and stop values. These data are used to calculate a displaying product listing page.
- checkDisplayPage($cat1, $cat2,$cat3,$num_rows,$each_page,$start,
$row_displayed): ): It uses these parameters values to check if the product listing
result is more or less than one page (each page displays five items).
- displayPage($cat1,$cat2,$cat3,$num_rows,$each_page,$start,$row_displayed): It
displays the page is being viewed.
- displayItems($cat1,$cat2,$cat3,$num_rows,$each_page,$start,$row_displayed): It
uses the parameters values to query data and displays a product listing on the webpage.
- displayButtons($button_arr): It uses the arrays data to display link buttons such as
Continue Shopping, View Cart, or Checkout.
class Shop_Functions
- addToCart():It involve processing HTTP_SESSION_VARS to adds items to cart
when a customer chooses to buy an item.
- viewCart($link_page, $change_button, $remove_button, $ship_price):
- calculatePrice($cart): It uses parameters values to query data from database and
calculates price for items in the cart.
class Confirm
- printItemsConfirm($template, $cart_items,$bill_ship_array): It uses the
parameters values to print out cart, billing, shipping information to the confirm page for
customers to take a review before they place an order.
- inputOrder($template, $billing_infor, $cart_items, $all_charge): It stores order
information in the database after customers send their orders.
- sendOrder($email_body, $order_num, $billing_infor, $cart_items, $all_charges,
$seller_email): It sends out order information to customers and shopping cart managers
via emails.
Appendix B
Database Schema Definition
Table: category_List
Fields:
-categoryID: int, primary key
-category1 : varchar(255)
-category2 : varchar(255)
-category3 : varchar(255)
Table: sale
Fields:
-model_name: varchar(255)
-orderID
: int(6)
-quantity
: int(4)
-price
: decimal(10, 2)
-total
: decimal(10, 2)
-date
: varchar(255)
Table: inventory
Fields:
-upc_code
-model_name : varchar(255), primary key
-category1
: varchar(255)
-category2
: varchar(255)
-category3
: varchar(255)
Table: cat1_cat2_cat3
-suggested_price: decimal(10, 2)
Fields:
-web_price
: decimal(10, 2)
categoryID: int(4), not null category1:
-image
: varchar(255)
varchar(255), not null
-thumbnail
: varchar(255)
category2: varchar(255), not null
-sale
: varchar(255)
category3: varchar(255), not null
-status
: varchar(255)
-finish
: varchar(255)
-discription
: text
-feature
: text
-review
: text
-manual
: varchar(255)
-brand
: varchar(255)
19
-dimension
: varchar(255)
-capacity
: int(6)
-weight
: decimal(10, 2)
Table: order_detail
Fields:
order_num: int(6), not null
quantity: int(3), not null
item_num: varchar(255), not null
Table: order_main
Fields:
order_num:[int(6), not null
order_date: date, not null
email: [varchar(30), not null
subtotal: decimal(7,2) unsigned, null
shipping: decimal(6,2) unsigned, not null
tax: decimal(6,2)unsigned ,null
total:Table:
decimal(7,
sale 2) undigned, null
ship_first:
Fields:varchar(15), not null
ship_last:
varchar(50),
nut null not null
model_name:
varchar(255),
ship_company:
varchar(50),
order_id: int(6),
not null null
ship_address[varchar(50),
not null
quantity: int(4), not null
ship_city[varchar(50),
notnot
nullnull
price: decimal(10, 2),
ship_state[char(2),
not 2),
nullnot null
total: decimail(10,
ship_zip[varchar(5),
notnot
null
date: varchar(255),
null
ship_phone[varchar(12), not null
ship_email[varchar(50), not null
bill_first[varchar(50),
Table: category not null
bill_last[varchar(50),
not null
Fields:
bill_address[varchar(50),
notnull
null
categoryID: int(11), not
bill_city[varchar(50),
not
null
category1: varchar(255), not null
bill_state[char(2),
not null not null
category2: varchar(255),
bill_zip[varchar(5),
not null not null
category3: varchar(255),
bill_phone[varchar(12), not null
bill_cell[varchar(12), null
bill_email[varchar(50), null
Table: cat1_cat2
Fields:
- cat1_cat2_ID: varchar(255) , not null
- cat1
: varchar(255) not null
- cat2 : varchar(255), not null
Table: inventory
Fields:
Table: cat2_cat3
upc_code:
varchar(255), not null
Fields:
model_name: varchar(255), not null
- cat2_cat3_ID:
int(10),not
notnull
null
category:
varchar(255),
- cat2 : varchar(255),
notnot
null
category2
varchar(255),
null
- cat3 :varchar(255),
not not
nullnull
category3:
varchar(255),
suggested_price:
web_price:
image: varchar(255), null
sale: varchar(255), null
status: varchar(255), null
finish: varchar(255), null
description: text null
feature: text, null
review: text null
manual: varchar(255), null
20
brand:varchar(255), null
capacity: int(6), null
weight: decimal, null
Table: customers
Fields:
email: varchar(255), not null
password: varchar(255), not null
firstname: varchar(255), not null
lastname: varchar(255), not null
zip: int(5), not null
21