Question
Using a mvc creating the following. You can use php, codeigniter, html, css to code the task. Customers buy products by searching for them. The
Using a mvc creating the following. You can use php, codeigniter, html, css to code the task.
Customers buy products by searching for them. The url to the search page is shop/search. The HTML table reporting the products matching the search includes each products Id, and clicking on the Id should take the customer to the purchase section of the website. The search page should have table with the product name, amount in stock and id, the id in the table should be a url to the buy page. The buy page url is shop/buy/Id (the id is a number of the product). It is linked from the HTML table returned by the search. The heading for the page should be, How many of Id would you like to buy from your-login. The Id is the product Id that the customer clicked on in the search results table. There should be a text box where the number of items desired is entered, and a buy button. Your website should then check that the desired number are indeed in stock, then decrement the number purchased in the Stock database table. The customer should know if they failed or succeeded. An authenticated admin can restock items. This is done with: shop/restock/Id The Id is the item to be restocked. There should be a text box where the number to be added can be entered, and a restock button. The Stock database table should then be updated.
Complete the code below.
select * from stock where id (where id is found)
select * from stock where no (where quantity is found)
(needs to check the stock of an item)
model functions:
public function check ($id, $quantity){
//code
}
(needs to decrement stock by how many products are purchased)
public function decrement ($id, $quantity){
//code
}
(increment stock by how many admin restocks)
public function restock ($id, $quantity){
//code
}
controller function:
( function needs to take user to url buy/id(the number of the id from database)
public function buy($id){
//code
}
(function needs to take user to url restock/id(the number of the id from database)
public function restock($id){
//code
}
view:
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