Answer the question
In order to leave comments, you need to log in
How to make products with different characteristics and price?
Tell me how you can make products that will be in different versions? Accordingly, each product option will have its own characteristics and price. DBMS I use mysql.
There is an option to make a table of goods. The product will have several varieties, to which properties (in a separate table) and price will be attached. But there is a sampling problem here, as well as some ambiguity. For example, in this case, not a product will be added to the cart, but its variety, which seems somehow not very cool. In general, tell me pliz how best to implement it.
Just in case, an example of product properties =)
Answer the question
In order to leave comments, you need to log in
This type of product offer is called a "variable product offer".
1. A unified product is created as an additional subsection in the desired product category and, preferably, marked with the "uniform product" flag.
2. All combination options available for purchase are created as separate product offers.
3. In the brackets of the name, we indicate all the parameters in pairs, separated by a colon, separated by a semicolon.
Example: Portable SSD (capacity: 128Gb; color: red)
4. Then, all created product combinations are placed in this category.
5. When displaying a product from the category "unified product" (or, if there is a colon in brackets in the product name), we determine that the product is variable.
6. If this is the case, we make a selection, having previously excluded the brackets (or more simply: all products of this category) from the database.
7. If there are several such products, we display options for selection.
8. When changing one of the variable parameters by the user, we change the product via ajax (or completely reload the page, which is worse ...)
Once again, I repeat : if it is not possible to mark a category in paragraph 1, you can simply focus on brackets and a colon, and create selectors on these grounds.
----------
1. Add a flag field to the section in the database: "variable product"
2. Add a separate table of variable characteristics, in which there are links:
ID of the "variable product" section, ID of one product characteristic, field type (better than the field ID and an additional table, but not so critical if there are not many options)
3. If we have several products from the desired variable section with such characteristics - display a selection of options.
4. see item 8 (from the previous section)
Yesterday I bought a sausage for 180 rubles, the day before yesterday it was 175, tomorrow they promised to adjust the stolen one for 70 ... is
the general hint clear? (item-batch-price-time)
The simplest and (for me) convenient option is the most hackneyed product:categories 1:N scheme, and the categories, in turn, are grouped into groups or in a tree as you like.
It is convenient to fill in this - when you insert or update a product, you just need to check the boxes to which categories it belongs. For example, white, 50 ml.
It is convenient to display the picture and the name of the product, and it is also easy to search by filter.
A specific product gets into the basket and there are no hassles with attributes, price calculation and other things.
As a result, how the scheme is clear - you can rename "categories" to "attributes", the meaning does not change from this.
If it has its own characteristic and its own price, and they do not need to be combined when searching, then there is no reason to do this not as separate goods.
You can set a base price for a product and, in a separate table, the price of product attributes in absolute or relative values. For example:
product Sausage: 100 rubles, Doctor's grade: 10 rubles or coefficient 1.1, weight 400g: -60 rubles or coefficient 0.4, total 100 + 10-60 \u003d 50 rubles or 100 * 1.1 * 0.4 \u003d 44 rub.
The second idea is to hash a set of attributes and give it a price.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question