My plan is to integrate the shopping cart into the home or product pages so users can view their carts without leaving their current page. It will store the user’s purchase information based on the data within the user’s session. An ‘add to cart’ button will appear when a user selects a quantity from a product, and once clicked, it will create a new key-value pair in their session. Users may add to their cart at any time, but to proceed to the invoice, they must be logged in. Otherwise, they are redirected to the login page. The user iS able to modify the quantities of items already selected in the shopping cart. Users will be limited to the quantity of inventory available when a entering a quantity.
I will implement sessions in Assignment 3 to manage my shopping cart information, such as what products are selected and how many of each product are selected. By holding this information in a session with an array, The following is an example; request.session.cart[products key] = userQuantities
where userQuantities is the array defined to store quantities input by the user. The user can view and edit this information in the shopping cart. My intention is to write a program that will overwrite the old information with the updated information when editing it.
By using cookies, I plan to make sure that users are logged out after a specified period of time (10 minutes). When a user visits the site, if the cookie stored on their browser does not match a session, they will have to login or register.
Cookies and session information will be used to implement the following: When a user successfully logs in, the login button will be replaced by his or her name in the nay bar. That button allows users to edit their accounts or log out. Additionally, the navigation bar will display the number of items in the shopping cart based on cookies and session information.
As I do not have a partner, I am unable to respond to this question.
There are a number of different elements in this assignment, such as login, different product pages, and the cart. The complexities of these elements prompted me to consider my options carefully before starting the coding process. For Assignment 2, I put myself through a trial and error process, but hopefully, this will change for Assignment 3. It would be very beneficial for me if was able to thoroughly think through them as to what syntax to use and how everything could be organized.