Question
Activity 1 - Product list page - Create a multi-dimensional array of products (you may hardcode the products for now). See M6 content - Multi-dimensional
Activity 1 - Product list page
- Create a multi-dimensional array of products (you may hardcode the products for now). See M6 content - Multi-dimensional Arrays.
- Use that array of products to make your add to cart links dynamic as you did in your previous Individual assignment. See content presentation for the week.
- You may start with the work you did in your group assignment or Individual assignment to continue this week's assignment.
- In a pdf document copy and paste the php code, screenshots of your work and zip file of your code.
This page should be powered from your array. Each add to cart link should be dynamic like this -
Set up your URL for the add to cart button like this.
$href="shoppingcart.php?productid=" . $products[0]["title"] . "&productname=" . $products[0]["name"] . "&price=" . $products[0]["price"] . "quantity=1";
Use that URL in the add to cart button. Loop through your array to dynamically generate the urls so instead of 0 above it will be a loop index $i.
">Add to Cart button goes here
Activity 2 - Shopping Cart Page
- Using the content provided in the lecture, when the user clicks on add to cart on a product take them to the shoppingcart.php page.
- Show the item that was added to your shopping cart in a neat table.
In the shopping cart page, use a session within which you have your cart. If shoppingcart already exists in the session, just add to it otherwise open a new shoppingcart in the session.
// to start session session_start(); // to check for cart in the session if (!empty($_SESSION['cart'])) { $cart = $_SESSION['cart']; }
Add items to your shopping cart in the session with the productID that you get from add to cart urls. To get the product name and price youll need to take them from the associative array (next week we will query the product name and price for that productID from the database). You should add products to the shopping cart in your session so that you can display all items in the cart as long as the session is active.
- Use associative arrays, multi-dimensional arrays (or whatever other method you want) to access your shopping cart items. Be able to add at least one item to the cart. If you use sessions you should be able to add more than one item to the cart. You will get full points if at least one item is added to the cart. You can send the item details through the URL (see screenshot below) for this assignment.
- Calculate Tax amount and add it to the total
- Your page will be similar to this (but only 1 item is required for now) :
Submit the following in a PDF file:
1. Screenshot of the productlist page with the code from productlist.php. Code should be provided copied and pasted into the pdf file below the screenshot. (15 points)
2. Screenshot of the shopping cart page with the code from shoppingcart.php. Code should be provided copied and pasted into the pdf file below the screenshot. (15 points)
4. A zip file of the project code. (10 points)
My Shopping Cart Application - Mozilla Firefox Eile Edit Yiew Higtory Rookmarks Iools Help C ( http://localhost/php/sample'shoppingcart.php?productid=3&productname:W . Yahoo Most Visited Getting Started B0 Latest Headlines D' . Mail . 2 weather . .. Flickr . ay Finance-r eBay. Amazon Shopping Cart Total $43.96 $59.98 119.97 Bill Total $223.91 Product Code Product Name Price Quantity S10.99 S29.99 2 39.99 3 ordless Mouse Harmony Remote Webcanm Checkout 2010 Innovations, Inc Done My Shopping Cart Application - Mozilla Firefox Eile Edit Yiew Higtory Rookmarks Iools Help C ( http://localhost/php/sample'shoppingcart.php?productid=3&productname:W . Yahoo Most Visited Getting Started B0 Latest Headlines D' . Mail . 2 weather . .. Flickr . ay Finance-r eBay. Amazon Shopping Cart Total $43.96 $59.98 119.97 Bill Total $223.91 Product Code Product Name Price Quantity S10.99 S29.99 2 39.99 3 ordless Mouse Harmony Remote Webcanm Checkout 2010 Innovations, Inc DoneStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started