In the e-commerce system, the commodity model is very important, is the core of the entire e-commerce, below through a simple analysis, the design of a basic commodity model.
Evolution of commodity models
In the past, when the CMS was very popular, the most common model is the column-article model. So when doing e-commerce, nature inherited this one-to-many relationship. Only the column became classified, the article became a commodity. The product also has unique business attributes. Now many e-commerce sites on the left side of the menu, that is, this category.
Later, we slowly found a problem, only the classification can not adapt to all the requirements, such as Nike shoes and Niket-shirts, users may want to see all of Nike's products, this model is not satisfied. We want to add the concept of "brand" in this relationship. So:
This allows basic users to find the items they want on the home page by category or brand, as well as direct access to popular items and new listings. But the problem also comes, the user enters the classification, displays in front of the user is many many goods, the user hoped again through the filter inquires the product which is closer to his goal. So a good product designer designed a UI like this:
Users can further narrow their target range through these filters, then the problem comes, so the product needs in front of the programmer, how to achieve it? After analysis, we find a method, we know that there may be a large difference between the properties of goods, such as jeans it has a version, waist type, pants length and other properties, and computer It has CPU, graphics and other properties, the properties of various products are different. Further thinking, casual pants also version, waist type, pants length and other properties, desktop computers or laptops have CPU, graphics and other properties. So we can conclude that a classification corresponds to several attributes, and an attribute, which corresponds to several attribute options, and a specific item that corresponds to several attribute options (for example, a specific pair of jeans, his pants length: 7 points, Pants type: straight tube). A bit around, taste it carefully.
As can be seen from the graph, the relationship between classification and attributes (e.g., trousers, trousers length, version, etc.), Attributes and attribute options (e.g., length of trousers, nine-point trousers, options for cropped trousers), and Commodity and attribute options (for example, a pair of jeans have a 7-minute trouser length). At this point, we know the classification of a commodity, its brand, and what its attributes and corresponding attribute values are. Then, by filtering the criteria, you can naturally query the specified product. In particular, the price is also a property, do not assume that the price field in the commodity table to do the calculation. This is not good for querying and adds complexity, allowing business editors to set and guarantee his correctness with attributes.
With this model, we can probably see the following interface ( Please do not focus too much on the left, focusing on the right and bottom ):
This page shows all the information about the product, as it seems to be satisfied with the previous design. But we seem to feel missing something, on the right side of the graph we find the current color and size of the product, and allow the user to choose other colors and sizes. This brings us doubts about the "color" and "size" here, a product of different colors and different sizes are counted as a commodity or multiple products. After thinking, we find that we confuse two concepts-"goods" and "goods". Different specifications of the goods as a separate product. For example, a pair of trousers have l size, m size, a U disk has 16G or 32G, are the same goods, different specifications of the goods. goods and commodities can be considered a one-to-many relationship. With this concept in place, it is much easier to deal with this requirement, where "color" and "size" are treated as "specifications", while red, black, L and M are the options or specifications that we see as specifications. One item corresponds to several specifications, and a product with a certain specification value is a commodity.
OK, now it seems to be almost there. Based on this model, we can meet the needs of basic commodity search and display. The search engine can also generate the corresponding product index according to the model data, and achieve the purpose of accurate search. Commodity modules also work with other modules, such as user systems, order systems, payment systems, and more. Under normal circumstances, we will separate the commodity business into a "commodity center" services, centralized processing of commodity inquiries, updates, releases and other business, supporting other businesses.
E-Commerce entity class analysis