A link to an overview of my application’s design can be found here
My sites shopping cart will be a separate page that a user will be able to click on and adjust quantities or remove products all together. Once they add products to their cart, they will be given the option to view their cart, check-out, or return to the home page. The cart will have to store and maintain user’s product data while a user is moving around product pages and assure that the data is in the format that the invoice is expecting.
Sessions will be utilized to manage my shopping cart as the method to store quantity data so that if a user logs-in they can return to their cart. The data stored within sessions will be through arrays in JSON. Unlike previous assignments, this one will require more than one variety and as a result will be formatted as such:
{“ribeye”: [0,0,0,1,0,0], “ny-strip”: [0,1,0,0,0,0], “porterhouse”: [0,2,0,0,0,1]}
In order to assure that users that are not logged in are unable to access certain parts of the application, I will utilize cookies to store that a user is logged in and sessions to maintain product data. When a user gets to the site, the cookie stored on their browser will either match them with a session or the cookie will not match and the user will have to login or register.
$_SESSION[‘loggedIn’] = true;
(When attempting to go to invoice)
if($_SESSION[‘loggedIn’])
else
header(‘Location: /login.html’)
Upon a successful login, the user’s name and email will be listed on the invoice and the user’s name will be listed on the navigation ribbon. I will also implement a delayed redirect that prints “Logging (username) in…”
I am not working with a partner.
In comparison to Assignment 2, I am trying to approach Assignment 3 with a lot more critical thinking and planning. Instead of just writing code, I am first thinking about how I want the different processes of the application to function. There are so many different ways to accomplish the same task within this assignment so it is crucial to plan the structure of the application out in order to assure that everything functions cohesively.