Welcome back.
Now it's time to work on editing and order.
And if you click on edit and order here, nothing is going to happen.
So we need to work on this button first.
So I'm going to go to the index.
The orders are in the index.
So in the index, the first thing that I'm going to do is that I'm going to head on over to the order
button.
Remember, we have here.
Order.
Button this, button this button, edit it not order button ever.
So the edit button will have a trip and this is going to take the user to the edit that edit underscore
order dot BHP and I'm going to add here the the guess parameter is going to be order ID, we need to
pass the order of the order.
It is going to be equal to.
The the order, it is going to be equal to the order.
Right.
So I'm going to add BHP.
I'm going to say BHP.
BHP.
And then echo.
Order.
Order 80.
And by the way, the older ID page is very similar to other pages.
There is nothing different they have added.
They had their file and they also have imported the.
I have also imported the side menu, which is this, and that's it.
And then I have here the edits in the page and every page has will only have a form and that form will
only allow that you allow the admin to edit the order status because there is, there is nothing you
need to edit about the order.
The only thing that you might need to to edit the order is the order status.
You will need to change the order status from not paid to paid or shipped or delivered.
And this also is not this also is not always important because after the user pays, the order will
go from not being to paid immediately, automatically, automatically and immediately.
And that you might in some cases you might need to change the order from not be to paid.
So for example, if if something with payments went wrong or for some other reason, you might need
to do this and then you might also need to change the pay to shipped or delivered.
So this is the only the only thing that's important here.
But first, let me turn over to the let here there over to the index and let me click on one of these
buttons on the edit buttons.
One of the buttons, if you click on this, it should take me to the edit page.
And here, as you can see, we only have this form and I'm just going to display the order ID and the
price and the date.
The status is the only thing that you can change.
So now in the edit order, what we need to do is that the first thing is that at the top below the header,
we need to create a code that's going to get the product information from a database and we already
have a code and the edit product that which we at the top remember we have here this code.
So I'm going to copy this.
Good.
And then I'm going to pasted in the edit order here.
I'm going to say BHP and then I'm going to be here.
However, we need to edit a few things.
First, we need to say order in order ID.
So the order ID here, order it is going to be equal to order ID, order ID and then we need to get
the select select select all from products where select all from orders where order ID.
Or it is equal to or is equal to question mark and then statement bind bahram i and then order and then
we execute and then we get the order.
I'm going to say the order and that's it.
And here, don't forget to close the clearly bracket.
So this is going to get us the order and here we need to display the order information.
So in the form we need to say here first we need to say inside this form we need to say for each, even
though this is an array of only one element, I'm going to say.
HB And then for each.
For each.
Order.
As far as our because I don't want to confuse you.
And then for each order as ah, I'm going to say ah here BHP and then Echo.
Echo are.
Order.
I ordered rice.
He ordered rice and.
Or it is a year I'm going to say BHP Echo are.
Product, not product.
Order.
Order I.D..
And lastly, we have here the order date.
Here.
I'm going to say beach B and then.
Echo.
Are.
Or date.
And for the category four or not, the category actually for the this is not the category.
This is the status.
So for this status, I'm going to say you status the name is status point is that as we want to add
the if statement and check which one is is selected.
So I'm going to say here if.
BHP and then.
If our.
Status.
Order.
Status.
Order.
Underscore status.
Is equal to is equal to.
Not paid.
Then we.
We say.
We echo here let me really copy this code actually when you to this plate inside the option so here.