M
M
masimka2017-11-17 17:31:02
Online shopping
masimka, 2017-11-17 17:31:02

How are product filters arranged in online stores?

How are filters in online stores arranged?
Is there a specific filter template stored for each category, according to which the product is added and filtered? How is the configuration done? Where can I read about this, maybe someone has experience in creating such tools?
There is a product with previously unknown additional options.
Eg. I have a refrigerator., I want to add a refrigerator to the database, with height, width, color, manufacturer, three chambers, installation type, and so on.
I add all this to the database as json, so that later I can search for it.
Now the filter on the site - according to which I want to choose, a two-chamber refrigerator, with a height of no more, and installation outside.
The filter makes a request to the database:
Select all refrigerators from the category of refrigerators where color = red, height less than 60 cm, right?
And now if I want to add some other parameter to this filter, for example, the presence of a quick freeze? And so that this parameter appears when adding refrigerators and in the filter on the site.
Somewhere I saw a similar solution for an online store on Yii (there was an open source project somewhere on the network). There, all the parameters of the product are placed in the cell for the product.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2017-11-17
@webinar

How are filters in online stores arranged?

Do you think there is 1 universal method for this? No. There are general concepts and there are several of them, and not just one + for each project, one should think separately how to rationally store it. It all depends on the number of products, the number of filters, the type of database, etc. There are many nuances.
Sadly. How will you search by json? Usually there is a table with products, a table with filters, there is a table with values ​​for a product by a certain filter. Something like:
id | product_id | filter_id | value
At the same time, filtering is quite a resource-intensive process, so it is necessary to reasonably create indexes in the database and cache queries.
There are many bad examples, don't look at them. Yii is a framework. The quality of the database architecture lies entirely with the programmer. yii gives you complete freedom of action in this regard. So crooked hands and the absence of a brain are the key to a poor result, and development tools have nothing to do with it.

A
Alexey Sklyarov, 2017-11-17
@0example

Of course not. The entire product filter is just a database query that returns data from the database that matches the query. For example, we have products with a rating of 5 and a rating of 4. We want to filter them. Each product in the table has a column: rating, which takes a value from 1 to 5.
In the filter, we select the value 5, after pressing the button: Apply filter, a request is sent to the server, a request is made to the database, something like: . This request returns us all products with a rating of 5. The server generates a new page for us, where you see all products with a rating of 5. SELECT product FROM products WHERE rating=5

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question