Welcome back.
Now, what we need to do is that we need to change the the the search criteria depending on the last
thing that user choice.
For example, if I say shoes a year and if I increase the the minimum price to 1000 and if I click on
search, this is going to get me shoes that are worth $1,000 and less.
But as soon as I get the result, the criteria will go back to the default.
And we don't want that.
We want to keep the criteria to the last to the last criteria that that the user choice.
So to do this we here in the shop that we in the price we need to say in the value we need to say BHP
and then we need to check the remember we need to check the price.
This is this price.
We need to check this price.
So if we have a price.
Laming, you say?
If.
Is sex.
Rice.
Then we need to display that price.
We need to say echo price.
Else here else.
What we need to do is that we need to echo the default value.
So the default value is 100.
I'm going to say 100.
That's it's pretty simple.
Similarly, for the categories here, we need to say instead of saying, checked for all for all of
these categories, we need to add up each because that's going to check the last criteria or the last
category that the user chose.
So here we need to say each be.
And then.
And then echo.
And then.
Before echoing you to say it if is said category.
Then.
Then I'm going to say eco.
Gothic, eco.
Eco checked.
Check to check this.
To take the this and then I'm going to repeat the same card to all other to all other categories.
So here instead of check them and remove this check again, I'm going to add this good and I'm going
to remove this checked and then I'm going to have this good and then we remove this checked of it.
I'm going to add this good and this is not enough.
We need also to say if category is set and.
And here.
And category is equal to the category here.
So what is what's the category here?
The category the category issues here with the smallest.
Because in the database, it's small.
It's not capital.
Similarly, in the second one, we need to say and.
Category is equal to courts.
And then here we need to say.
And.
Category.
Is equal to.
Watches.
And lastly, we carry the category here and.
Category is equal to.
Max.
Let me save it.
Let me now refresh and show you how awesome this is.
Now, if I refresh and select, for example, shows and say five, 500 and click on search, the criteria
will will remain the same will remain the the the last criteria that I selected.
If I say here the last category and last price that I selected, if I say costs and 1000 and click on
search.
As you can see, it's going to get me costs that are $1,000 and less.
And the the the values will remain the same here, which is amazing.
Lastly, where they want it to to emphasize on is that either the search functionality you can modify
this for example, you can add more categories if you want.
If you have more categories in your database, you can add them, for example, if you have.
Maybe you have other things such as, let's say you have shoes, cards, watches, bags, dyes, maybe
ties, maybe glasses, sunglasses.
You can add them.
But you need you need to make sure that you have them in the database so that you get products.
If you don't have them in the database and the user searches for for one of these categories and clicks
on search you, they are not going to get anything because you don't have them in the database.
So you need to add them to the database in order to make sure that the user will get them.
So this search functionality is very, very important and it's going to help the user a lot because
the user might not be interested in all products and they may be interested in one category.