Establish a reasonable commodity class and navigation class

xiaoxiao2021-03-06  82

Establish a reasonable commodity classes and categories of navigation: abin Time: 2004.10.12 Source: http: //blog.9cbs.net/abinstudio an e-commerce website is the core catalog, catalog can be divided into two parts: 1 Categories , 2. Navigation class. If the product navigation and classification are not done, the user can't find the item you need on your site (this item you have sales), this is the most failure.

Basic requirements for commodity classification: 1: Flexible 2: can be retractable 3: Reliable 4: speed fast

In fact, these requirements require mutual constraints because a highly flexible classification will lose in reliability, the higher the scalability, the lower the speed. Here, it is transfibrated by the programmer's angle.

Many times I think that the catalog should be unlimited level, I have been thinking, but in the development of a recent e-commerce website, it is actually not ideal, because the classification of unlimited levels causes a lot of occupation of system resources, in order to Insufficient solving, I bundled the product catalog in the ASP.NET in memory, and the speed problem is basically resolved, but it has a large amount of memory. So I have to face a compromise, because most small and medium-sized e-commerce companies use virtual hosts, which requires the website to have enough implementation efficiency, otherwise functions are garbage. Below some actual classification example: Jewelry / Watch / Glasses> Tibetan, Other Ethnic Ornaments> Necklaces, Tiertois Jewelry / Watch / Glasses> Gems> Rings, Ring

Computer / Software / Network / Office> New Laptops> IBM Computer / Software / Network / Office> Computer Peripherals> Printer / Software / Network / Office> Desktop Computer> Lenovo Computer / Software / Network / Office> Handheld / PDA > HP / IPAQ Computer / Software / Network / Office> Supplies> Printing

Computer / Network / Office Equipment> New Laptops> Lenovo Computer / Network / Office Equipment> Electronic Dictionary / E-Book> Wencus Computer / Network / Office Equipment> Server / Workstation / Network> NIC

Computer Synthesis >> Desktop Machine >> Lenovo Computer Synthesis >> Storage Equipment >> Mobile Hard Disk Computer Comprehensive >> Workstation >> HP

The above is a few large B2Cs in the C2C website classification, which is also a familiar classification form. The following start analysis: I have made a mistake when I write a few e-commerce website systems. This error is an empirical problem. It is divided into three categories on the surface, and the relationship is from large to small. Therefore, when designing the database, just like this: "Computer Comprehensive >> Desktop Machine >> Lenovo" as an example ---------------------- -------------------------------------------------- ------ CategoryID Description Parentcategoryid 1 Computer Comprehensive NULL 2 Desktop 1 3 Lenovo 2 ----------------------------- -------------------------------------------------- -

It looks reasonable, because the database is designed to design it, it feels that there is no problem, the logic is also correct, and the navigation class is classified together, that is, commodity navigation, and commodity classification. But when the website starts to use, the website management person tells me that it is very difficult to divide, it is often easy to make mistakes (people's logic thinking is very flexible for secondary classifications, but is very awkward for the third level). In addition, due to the above three classification, the difficulty is also increased when writing the program, the first is the stored procedure, and it is clear that the efficiency becomes low in the simulation (because each time I read the second level) When the catalog is traversed to read the third-level directory), more importantly, it will become a dead board when designing the product navigation. If you want to change a navigation name, you need to change all the products belonging to the class. Sit down again and analyze the problem, solve the above defects. In fact, "Computer Synthesis >> Desktop" This classification can be seen as a secondary classification, ie "desktop machine >> Lenovo" rather than three. Everyone knows that it is very easy to implement, as follows: ------------------------------------ ------------------------------------------ CategoryId Description ParentcategoryID 1 table Machine NULL 2 Lenovo 1 3 Storage Equipment NULL 4 Mobile Hard Disk 3 5 Workstation NULL 6 HP 5 ----------------------------- -------------------------------------------------as long as ParentCategoryId is NULL is the primary directory, not null is the secondary directory. It is also simple when using the stored procedure, it is not necessary to traverse the third level, and the efficiency is very high, plus using ASP.NET Cache technology, first determined if there is a classification in the cache when reading a product classification, if there is a classification, if not, the speed problem is resolved.

However, the second-level classification is unable to meet the product classification navigation. In order to facilitate customers to find the goods they need, the solution is to add two tables, called "CatalogLists" "CatalogListItems" is quoted by the reference related class to this table, first look See the table structure: ---------------------------------------------- ------------------------------------ CatalogLists: CatalogListid Description 1 Computer Comprehensive 2 Mobile Comprehensive 3 Office Equipment - -------------------------------------------------- ---------------------------- CatalogListItems: CatalogListId Categoryid CatalogListId Adminscription 1 1 1 Computer Comprehensive Class 2 3 1 Computer Complex 3 5 1 Computer integrated class --------------------------------------------- ---------------------------------- Three forms through the above, realize the secondary directory and navigation The total effect seems to be a three-level directory, the operation process is like this: first reading The nautical directory list CatalogLists and then read the CategoryID in the table, and then read the classification of the corresponding secondary. And in the design time of commodity navigation, just read CatalogLists, any change in the product navigation name, as long as the name in the table of CatalogLists (the change in commodity navigation name is often appearing in the e-commerce website, such as due to holidays Promotion, etc.)

Summary, from the structure of the table, there is a lot of structures, but it is not complicated when the SQL statement is written, the design of the navigation bar is flexible, and it can be changed and added at any time. Because there is only one table, the efficiency is naturally high.

转载请注明原文地址:https://www.9cbs.com/read-107472.html

New Post(0)