Q
Q
Qixing2015-03-10 04:25:20
PHP
Qixing, 2015-03-10 04:25:20

How to properly design product parameters for categories in an online store?

Good afternoon.
Interested in opinion and experience in designing an online store.
Brief:
Each product belongs to a specific category.
Therefore, each product has its own special attributes depending on the categories.
For example:
Tires: width, height, diameter, drilling.
Clothes: size, color.
Each attribute can be hard-selected from select.
Implementation:
1) Dynamic
We have two tables
item_category_property (id, category, name, values ​​(ser. array of values ​​for select / checkbox)
item_property_value (id, item_category_property, item, values
​​Plus - it's easy to generate attributes for each category from the admin panel.
Cons - with large volumes, stupidity in the samples. You can not sharpen the interface in the administrative part for more convenient use
2) Statics
One table item_category_XX (Where xx is the category id). We will store already predefined data types, which will allow us to conveniently design the interface and write business logic.
Cons - with the n-th number of categories for each category, it is inconvenient to create a table (you will have to do it yourself at the database level)
How to store links at the program level in order to do JOIN?
A category can be a child, so the parent relationship also has common parameters.
Are there any universal options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2015-03-10
@zoonman

attribute_group [id, name, order]
attribute [id, group_id, name, order]
attribute_value [id, value]
product_attribute [product_id, attribute_id, attribute_value_id]

Different products can have attributes combined into groups. They can be sorted by the order field.
If necessary, you can create a relationship between categories and attribute groups.
Do not be afraid, there will be complex queries, but due to decomposition, the amount of data will be reduced.
The complexity of queries is easily leveled by caching.
And you still need to grow to millions of products in the tables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question