Welcome back.
Now, what I'm going to do is that I'm going to take the ordering information, the order that the user
did not pay for.
And if the user clicks on pay now, I'm going to get the total amount from here and then I'm going to
display it here, and then I'm going to display the button so that the user will be able to pay for
any order they have.
So for example, this is my account and I have these orders not paid.
And if, for example, I want to the I want for for for some reason I want to pay.
Now I can click on details and then pay now and pay for this and get this product.
So to do this, we need remember in the order details, we have uniform and we need to pass the the
total just the total.
We aren't interested in the entire data because the data is already displayed.
So, for example, Amy, show you this order.
This order has.
Not this one.
Actually, this one.
This order has.
I think this one yes, this one has two products and the user already knows that at this point, if
the user wants to check the order details, he or she would come to this page and they would be able
to check the details.
And if you if they click on pay now, they already know that the the price is going to be for this juice
is going to be 155 and for this bag is going to be 250.
And if they click on pay now, we just need to display the total and the pay button.
That's it.
So to do this here in the order details, remember we have we have here the image and they name the
price and the quantity and all we need to do is that we need to give the total.
So here this is going to get us the products.
All we need to do now is that we need to get the total and to get the total we need to add the total.
We need to calculate the total.
And fortunately we already have the code.
If you go to the cards, you will find that they have a function called calculate total.
So we can copy this function, we can copy it from here and the order details.
And then in the order details specifically you can base this function and use it.
But we need to fix this function because this function now is going to get data from not from this session.
And instead it's going to get these are from here from from the order, price and quantity.
So we need to get the order price and the quantity.
So we have the order details.
Remember this order details is a is a is is going to is going to be on our day so we can copy this line
of code.
Which actually we can't copy the entire loop.
We can copy this while.
And then in the in the in the cart in the calculate the total cart here, I'm going to say calculate
total order, order price.
Because this is now this is not the cart now.
This is an order.
This is a delayed order.
This is an order that the user placed sometime in the past and they did not pay for it.
So this order has been placed, as you can see here in the account, the order date has been placed
some time in the past.
And then if the user clicks on details and want to pay, then they will be able to pay today.
That day that they clicked on the button.
So here in the calculate total order price.
So here in the calculate total price, then I'm going to save, which I'm going to say while raw order
details which are source and I'm going to close the loop.
And instead of doing this instead of instead of using the V this code, I'm going to remove this.
I'm going to remove this code.
Instead, I'm going to get I'm going to get the year raw.
And then when do we want to get we want to get the remember, we need to get the product.
Price and quantity.
So here I'm going to say product underscore price.
And then I'm going to store it in a valuable cold product.
Rice.
And then.
Product quantity.
Is equal to ra ra ra ect.
Product.
One.
We wanted.
And then we need to multiply the price by the quantity.
We need to say
like the year.
We need to multiply the price by the quantity.
We need to say price.
Product price multiplied by product quantity.
And then add these inside brackets and then last year less total.
Is equal.
Everything now is going to be equal to the total.
Total.
Total is going to be equal.
Total is going to now be equal to the total.
And we can now remove this.
We can remove this.
And finally, we need to store that in a valuable well already there.
We can either return for it or store that in a valuable.
We can here say return, for example, daughter.
And here we need to pass the order details.
So where can we get the or details from?
We should get the order details from here.
So here.
Here.
We need to call.
After we execute this.
After we execute the code, we need to say calculate order.
Calculate total.
Total order the price.
And then pass the order.
Details, order, details.
And this is going to return the total.
Total order.
Now the total order is here.
We can use it.
And by the way, we need to pass the parameter.
We need to pass the order details.
Don't forget to pass it.
And that's it.
The function now is fine.
Just calls the function and you don't have to worry about this function ever again.
This function will be called here and that's it.
And here you can say total order.
Right.
Just to make sure that you understand.
Now at the bottom.
At the bottom.
We can use it.
So at the bottom.
We can use it here in an input.
In a hidden input, we can say input and then type text.
And then I type actually not text here then because we don't want to show this here hidden.
And then the value is going to be equal to BHP.
And then echo.
Echo dot tell.
Order.
Rice semicolon and the name here went to give it a name.
I'm going to say your name is equal to total.
Rice.
Total order price.
And for this for this button we need to say name is equal to pay now pay underscore now or be order
or order let's say order pay button and.
Lastly, we need to get order status.
So also the order status is very important.
I'm going to give you another input input type.
He then name.
Order starters value.
BHP.
Echo.
Order starters.
Or semicolon.
That's it.
Now in the.
In the payment.
We need to receive these parameters here.
We set payment that BHP and post.
So in the payment that BHP would need to receive the order status.
And here at the top we can you say order a first if.
Is set.
Lost.
Order may be be.
Then we need to get.
What do we want to get?
We want to get the boss order status.
And we need to get the past.
Order.
Don't tell.
Order.
Rice and let me rename this because I want to be consistent.
It's very important to be consistent.
So at the top here, I said I said total rice.
Total total ordered rice.
Let me say.
Order, total price.
Order total.
Right at the bottom.
Also, I'm going to say, I think this is going to be consistent and better.
I'm going to say in order.
Underscore total price.
Similarly with the echo here, I'm going to say total order.
Total order.
Total price.
And he order, order status.
Very, very consistent.
So in the here I'm going to say order.
Order.
Well, tell.
Grace.
And read the story.
This a variable I'm going to say.
Order.
Order!
Status and order.
Order.
Go tell.
Bryce.
And in the bottom, we need to display them.
So to display them, we need here we need to say, remember here I said order status and order status.
We need to say we need to use the past instead of get because here I used it get let's say fast.
So if the order status is is is equal to not paid, we need to display the button.
And also here, let me move this line of goods and pasted about this.
And here if a forced.
Order status is set.
We need to say order.
Status here must.
Order starters.
Similarly with the.
Total payment.
A physician is is a physician total.
They need to display the total.
And we need to say else we need to say you don't have an honor, but I'm going to work on this later
because it's going to it's going to get complicated.
Let me now say and let me refresh and now let me click on details and then let me hear.