Order Status
Order Number Status

Enter order number:

About

This app is built in:

Application:
Functions{
Check order status and order details info display: PHP, AJAX, SQL, JQuery{
>JQuery slides down the Order Display Grid
>PHP and SQL query MySQL database and display the status of the latest 5 orders in ascending order
>When order number is entered, AJAX and POST/GET method send off order info to .php file
>PHP processes the info, has SQL query the database, and returns the info in a table format back to AJAX
>AJAX displays the order details info in the Order Display Grid (only) without refreshing the page
}

Add items function: PHP{
>POST/GET method sends off items to .php file
>PHP stores items in $_SESSION[cartArray][itemsArray[attributesArray]] (which means multi-dimensional array)
}

Remove items function: PHP{
>POST/GET method sends off items to .php file
>PHP removes items from $_SESSION[cartArray][itemsArray[attributesArray]] (multi-dimensional array)
}

Display items in cart: PHP{
>PHP queries $_SESSION["cart"] after items stored and displays them
}

Empty cart function: PHP{
>PHP unsets $_SESSION["cart"], which makes cart empty
}

Checkout button behaviors: JQuery{
>placeOrderForm slides down
>checkout button hides
}

Lookup order button behaviors: JQuery{
>table of the latest 5 orders status hides
>table of the order details being looked up comes from AJAX shows
}

Place order: PHP, SQL{
>POST/GET method sends off customer form info to .php file
>PHP and SQL store customer info in $_SESSION["customers"]
>PHP and SQL insert customer info into tblCustomers in MySQL database
>PHP and SQL insert order info into tblOrders in the database such as: tblOrders(item_id, qty, customer_phone, "In Progress")
>PHP generates order number, which is captured partially from session_id with concatenated incremental
>Order number is given to customers with info echo'd back from $_SESSION["customers"]
}

Fill order: PHP, SQL{
>PHP and SQL querry MySQL database and display "In Progress" orders that need to be filled
>When "Complete" button is clicked, POST/GET method sends off order info to .php file
>PHP and SQL update the "Ready" status on the order accordingly into the database
>When hyperlink order number is clicked, POST/GET method sends off order number info to .php file
>PHP processes the info, has SQL query the database, and populates/displays the order details info in the Order Details Display Grid
}

Auto-populate new incoming in progress orders: JavaScript{
>JavaScript setTimeout calls the function to refresh the page every 15 mins (or based on the time set)
>The page is reloaded, which means repopulating any new incoming in progress orders to be filled
}

Input validity: JavaScript, HTML "required"{
>If phone number, which is a required field, is not entered, alert message insists
>If quantity, which is set to be between 1-5, is not within the range, alert message insists
}

Display menu: PHP, SQL, HTML, CSS{
>PHP and SQL query MySQL database and display the items in the menu
>PHP and HTML provide "Add to cart" option for every item displayed in the menu
}
}

Shopping-cart algorithm{
action will be triggered by the GET/POST method
case: add
if there's qty to be added with item_id sent from the GET/POST method
query database statement by item_id and store results in resultset
store info in setupArray as: array[itemsArray[item_id][array(name, item_id, qty)] (multi-dimensional array)

if cart not empty (which means there's something in cart)
if item_id found in cart
loop through cart
if item_id == item_id in cart
update qty as: cart[cart][item_id][qty]=post[qty] (or += post[qty])

if to-be-added item_id not found in cart
merge cart (which means add new to cart)

if cart empty
update cart by array from setupArray

case: remove
if cart not empty (most likely not, but just to be safe)
loop thru cart
if to-be-removed item_id == item_id in cart
remove (unset) the item_id in cart
if cart empty (this scenario shouldn't happen, but just to be safe)
unset cart

case: empty
empty (unset) all items in cart
}

Database Tables(
tblItems(item_id, type, item_name, description, price)
tblCustomers(phone, last, first)
tblOrders(order_num, order_date, status, phone)
tblTransactions(trans_id, item_id, quantity, order_num)
)

Theme: HTML, CSS, Graphics, PHP (from scratch)