Question
Question: Test the Guitar Shop application 1. Start the Chrome browser and run the application in the ex_st... Test the Guitar Shop application 1. Start
Question: Test the Guitar Shop application 1. Start the Chrome browser and run the application in the ex_st... Test the Guitar Shop application 1. Start the Chrome browser and run the application in the ex_starts/ch05_ex1 directory. This should display a menu that lets you navigate to the Product Manager application or the Product Catalog application.
2. Use the Product Manager application to add a new product to the database with Guitars as the category, test1 as the code, Test Product 2211 as the name, and 550.00 as the list price.
3. Go to the Product Catalog application. To do that, you can use the Back button or run the application again. Then, view the product that you just added. Note that it doesnt display an image for the product. To fix that, go to the images directory and change the name of the test.png file to test1.png.
4. Go to the Product Manager application again. Then, click on the List Categories link at the bottom of the page. Note that this link doesnt display a page, even though it is coded correctly. Youll fix this later when you enhance the index.php page for this application. Now, click the Back button. Enhance the Product Manager application Now, youll add a page to the Product Manager application that lets you add or delete categories. This is similar to what you did in exercise 4-1, but using the MVC pattern. The new page should look like this:
5. Open the category_list.php file in the product_manager directory. It contains some of the headings that youll need for this page, and a link back to the Product List page. THIS IS WHERE THE WORK IS TO START. PLEASE LABEL WHERE YOU PUT THE ADDITIONS AND CHANGES IN THE CODE. THANK YOU!
6. Open the index.php file in the product_manager directory and add an action that displays the Category List page. Then, test this to make sure it works correctly. At this point, the page should only display some of the headings.
7. In the category_list.php file, write the code that creates the category table shown above with all of the category names in the first column and Delete buttons in the second column. Then, test this to make sure the page displays the table correctly.
8. In the category_list.php file, write the code that lets the user add a category to the database. This code should consist of a form that accepts the name for a new category followed by a Submit button that displays Add.
9. Open the model/category_db.php file and add two functions to it that add and delete categories.
10. Open the index.php file in the product_manager directory and add two new actions to it. The first action should add a category to the database. And the second action should delete a category from the database. Tip: To return to the Category List page after adding or deleting a category, you can pass an action to the controller with a statement like this: header('Location: .?action=list_categories');
11. Test the application by adding two categories. Then, navigate to the Add Product page and note that the drop-down list includes the new categories.
12. Test the application by deleting the categories that you just added. However, dont delete any of the existing categories because that will lead to products without categories. If necessary, though, you can restore the database by running the create_db.sql script again as described in the appendix.
13. If the formatting of your page isnt exactly like the one above, dont worry about that. The focus here is on web programming, not HTML and CSS. Refactor the Product Catalog application
14. Open the product_list.php and product_view.php files in the product_catalog directory. Note that these files use the same code in the tag to display the list of navigation links for each category.
15. Create a file named categories_nav.php in the view directory, and copy all the code for the tag from the product_list.php file to the sidebar.php file. Then, replace the code for the tag in the product_list.php and product_view.php files with the appropriate include statements. 16. Test these changes to make sure your refactoring works. category_list.php
Step 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