<!DOCTYPE html>
<html>
<head>
<title>Shop.com Shooping Application</title>
<style>
a {color:white; background-color:blue; text-decoration:none; border:2px solid black; border-radius:10px}
table {background-color:lightgray}
th {color:white; background-color:black;}
table,th,td {border:2px solid black; border-collapse:collapse; vertical-align:top; padding:5px}
</style>
</head>
<body>
<h1 align=center>Shopping Application</h1>
<h2 align=center><a href="javascript:top.location.href='shop.py'"> shop.py </a></h2>
<h3>This is a full shopping application with shopping cart capability. It is written in Python, and uses cookies.
<br>Below is a list of components and their functions.</h3>
<br>
<table>
<tr bgcolor=lightgray><th>Tables<th>Description and Keys
<tr>
<td><b>shop_product</td>
<td>This table holds product information such as product description, product type, price, etc.
<br><b>Primary key: </b>prod_id
<tr>
<td><b>shop_cust</td>
<td>This table holds customer registration/profile information such as user, password, name, address, etc.
<br><b>Primary key: </b>cust_id
<tr>
<td><b>shop_cart</td>
<td>This table holds customer shopping cart content such as product description, quantity, price, etc.
<br><b>Primary key: </b> item_id
<br><b>Foreign keys: </b> <i>cust_id</i> and <i>prod_id</i>
<tr>
<td><b>shop_order</td>
<td>This table holds completed orders with data such as customer name & address, credit card, sales tax, etc.
<br><b>Primary key: </b> order_id
<br><b>Foreign key: </b> <i>cust_id</i>
<tr>
<td><b>shop_order_detail</td>
<td>This table holds completed orders with data such as customer name & address, credit card, sales tax, etc.
<br><b>Primary key: </b> order_dtl_id
<br><b>Foreign key: </b> <i>order_id</i>
<tr bgcolor=lightgray><th>Cookies<th>Purpose and Duration
<tr>
<td><b>cust_id</td>
<td>This cookie is created once a user logs in successfully, and deleted once user logs out, or closes the browser.
<br><b>Purpose: </b>This cookie is retrieved in all subsequent pages. If no cookie, the user is redirected to the log in page.
<br><b>Duration: </b><i>temporary</i>
<tr>
<td><b>cust_user</td>
<td>This cookie is created once a user logs in successfully, and requesting that the userid be saved for future login sessions.
<br><b>Purpose: </b>The purpose of the cookie is to enable the customer not to have to enter their userid when logging in.
<br><b>Duration: </b> <i>7 days</i>
<tr bgcolor=lightgray><th>Python Pages<th>Description and Functionality
<tr>
<td><b>Shop.py<td><ul>
<li>This is the login <b>entry point</b> to the application.
<li>Allows you to <b>login</b> or to <b>register</b>.
<li>The script also allows you to <b>log out.</b> (<i>This can also be done via a call from the other pages</i>).
<li><b><u>If logging in</u></b>, the script retrieves the customer information from the <b>shop_cust DB table</b>.
<li>A row must exist in the customer table, and the password must match what is entered.
<li>If login is successful, the <b>cust_id</b> (<i>from the shop_cust table</i>) is saved as a <b><i> temporary </i>cookie</b>,
<br>and the script <b>redirects</b> to the <b>shopBrowse.py page</b>.
<li>The temporary <b>cust_id cookie</b> is used in all subsequent pages to ensure that customer has properly logged in.
<li>The script allows the customer to save his/her userid. If so, <b>cust_user cookie</b> is saved for 7 days.
<br>Next time the customer logs in, he/she only needs to enter the password.
<li><b><u>If register</u></b>, the script <b>redirects</b> to the <b>shopProf.py page</b>.
<li><b><u>If logging out</u></b>, the temporary cust_id cookie is deleted.
<tr>
<td><b>ShopProf.py<td><ul>
<li>This script allows you to either <b>register</b> a new user, or <b>update profile </b>for an existing user.
<li>The script checks the temporary <b>cust_id cookie</b>.
<li>If the cust_id cookie does not exist, this means a new registration.
<li>If the cust_id cookie exists, this means it is an update to the customer previous profile information.
<li><u><b>If new registration</b></u>, the script allows you to enter a new userid, password, name, and other information.
<li>The entered userid is checked against the database to ensure that it is unique, and does not already exist.
<li>If OK, the data is inserted in the <b>shop_cust DB table</b>, with a newly generated <b>cust_id</b> value.
<li>The cust_id is saved as temporary cookie to facilitate further processing.
<li><b><u>If update to profile</u></b>, the script allows you to update your registration profile within the shop_cust DB table.
<li>The script does not allow you to change your userid, all other data can be changed.
<li>The script also allow you to delete your customer profile. (<i>This feature has been deactivated</i>).
<tr>
<td><b>ShopBrowse.py<td><ul>
<li>This script allows you to <b>browse</b> the product catalogue, and to add items to your shopping cart.
<li>The script checks to see if <b>cust_id cookie</b> exists. If not exist, the script <b>redirects</b> you to the login <b>shop.py page</b>
<li>The customer can scroll and search through the various available products.
<li>The page allows the customer to add one or more products to a shopping cart.
<li>The user adds items and quantities to the shopping cart
<li>The script inserts or updates items into the customer's <b>shop_cart DB table</b>.
<li>If the item quantity is reduced down to 0, the item is deleted from the shopping cart.
<li>The user has the ability to view the cart. If so, the script <b>redirects</b> to the <b>shopCart.py page</b>.
<li>The user also has the ability to checkout. If so, the script <b>redirects</b> to the <b>shopCheckout.py page</b>.
<tr>
<td><b>ShopCart.py<td><ul>
<li>This script allows you to view and/or update the content of your shopping cart.
<li>The script checks to see if <b>cust_id cookie</b> exists. If not exist, the script <b>redirects</b> you to the login <b>shop.py page</b>
<li>The customer has the ability to change the quantity of a shopping cart item.
<li>The customer can also delete an item or reduce its quantity to 0, which will also delete the item
<li>The customer can either return to more shopping, in which case, the script <b>redirects</b> to the <b>shopBrowse.py page</b>.
<li>Or, the customer can choose to checkout. In this case, the script <b>redirects</b> to the <b>shopCheckout.py page</b>.
<tr>
<td><b>ShopCheckout.py<td><ul>
<li>This script allows you to <b>checkout</b> (add a new order) to the database.
<li>The script checks to see if <b>cust_id cookie</b> exists. If not exist, the script <b>redirects</b> you to the login <b>shop.py page</b>
<li>The script retrieves data from the <b>shop_cust DB table</b> and the <b>shop_cart DB table</b>.
<li>Data is displayed on the screen.
<li>The customer has the ability to change information (including name/address).
<li>The customer can also return back to the shopping cart to change its content. If so, the script <b>redirects</b> to the <b>shopCart.py page</b>
<li>Customer is asked to provide credit card information.
<li>When customer clicks on "Place Order" button, the script inserts data into the <b>cust_order</b> <i>and</i> <b> cust_order_detail DB tables</b>.
<li>The script also deletes all rows for the customer's shopping cart from the <b>shop_cart DB table</b>
<tr>
<td><b>ShopQuery.py<td><ul>
<li>This script <b>displays</b> a list of all processed orders.
<li>The script checks to see if <b>cust_id cookie</b> exists. If not exist, the script <b>redirects</b> you to the login <b>shop.py page</b>
<li>The script retrieved all rows from the <b>cust_order DB table</b> and the <b>cust_order_detail DB table</b>, and displays those on the screen.
<li>The client has the ability to <b>sort</b> (<i>ascending & descending</i>) by name, address, product ordered items, etc.
<tr>
<td><b>ShopSearch.py<td><ul>
<li>This script <b>displays</b> all or some processed orders, and allows you to <b>search/filter</b> through the orders.
<li>The script checks to see if <b>cust_id cookie</b> exists. If not exist, the script <b>redirects</b> you to the login <b>shop.py page</b>
<li>The script retrieved all rows from the <b>cust_order DB table</b> and the <b>cust_order_detail DB table</b>, and displays those on the screen.
<li>The script has the ability to <b>search/filter</b> for particular name, address, product ordered items, etc.
<li>The client has the ability to <b>sort</b> (<i>ascending & descending</i>) by name, address, product ordered items, etc.
</table>
<br><br>
<body>
</html>