如何在电子商务网站的数据库中创建产品规格表格。

huangapple go评论65阅读模式
英文:

How to create product specification table in database for ecommerce site

问题

我正在进行电子商务项目,对于在数据库中创建表格有一点困惑。

现在,我正在创建多个像flikart一样的电子商务产品。对于服装,我需要不同的规格(颜色、尺寸),而对于手机,我需要不同的规格(内存、存储),每个产品都有不同的规格。

如果我在前端查看页面(如果我选择了手机,那么它应该只显示基于手机的规格)。

如何为此目的创建表格。

英文:

I am working on ecommerce project i had little confusion to create table on database.

Now i am creating multiple product in ecommerce like flikart.
for clothing i need different specification(color,size) and for mobile i need different specification(ram,storage) and each product i had different specification.

If i view the page in front end (if i selected mobile means it should display only specification based on mobile phone).

how to create table for this purpose.

答案1

得分: 1

你需要学习关于 EAV 概念,即实体属性值。

你的表可以是:

categories(id、title、parent_id、status);这里的parent_id用于处理子类别。
products(id、title、description、price、status、quantity)
attributes(id、title、status);属性可以有颜色、尺寸等。
attributevalues(id、attribute_id、value、status);它包含颜色的attribute_id,值可以是绿色、红色、黄色等。
attributes_products(id、product_id、attribute_id、attributevalue_id、price、sign);它将属性标题与产品的选项关联起来,还可以指定产品属性的价格增加或减少多少。

在查询方面,如果有更多问题,请提出。

英文:

You need to study about EAV concept which is Entity Attribute value.

your tables could be:

categories (id, title, parent_id, status) ; here parent_id is to handle child categories
products (id, title, description, price, status, quantity)
attributes (id, title, status) ; attribute can have colors, sizes
attributevalues (id, attribute_id, value, status) ; it contains colors's attribute_id and values can be green, red, yellow etc
attributes_products (id, product_id, attribute_id, attributevalue_id, price, sign) ; it will be attaching attribute title with options to a product also how much price add or minus in case of products attributes

in case of query, do ask more

huangapple
  • 本文由 发表于 2020年1月3日 17:11:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575779.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定