在电子商务数据库中制作产品组的方法

时间:2022-05-01 01:10:03

I have the following scenario in my database: 在电子商务数据库中制作产品组的方法

我的数据库中有以下场景:

With this structure, I can show the following information to my user:

通过这种结构,我可以向用户显示以下信息:

"Your cart has 2 products, with the total of $400

“您的购物车有2个产品,总计400美元

  • Product 1, $100
  • 产品1,100美元

  • Product 2, $300
  • 产品2,300美元

  • Total: $400 ".
  • 总计:400美元“。

My company wants to sell products inside groups to give discounts to its customers. And I need to show information like this:

我的公司希望在集团内部销售产品,以便为客户提供折扣。我需要显示这样的信息:

"You are buying Product Group 1 which has the following products:

“您购买的产品组1包含以下产品:

  • Product 1, $100
  • 产品1,100美元

  • Product 2, $300
  • 产品2,300美元

  • Product 3, $240 .... Total: $1000".
  • 产品3,​​240美元....总计:1000美元“。

So I've remodelled the database to something like this: 在电子商务数据库中制作产品组的方法

所以我把数据库改造成这样的东西:

But I'm facing some problems, and would like to know if this the best way to work with item grouping in an ecommerce application?

但我面临一些问题,并想知道这是否是在电子商务应用程序中处理项目分组的最佳方式?

A customer can choose this package into his cart with (or without) other individual products, what kind of generalization can be used here?

客户可以选择将此包裹放入购物车中(或不包含)其他单个产品,这里可以使用哪种概括?

1 个解决方案

#1


You do not need to create the extra table, you need to be able to let products have a master product and a add a product type code to the table.

您不需要创建额外的表,您需要能够让产品具有主产品并向表中添加产品类型代码。

That way you could have product 2 and 3 link to product 1. If you add product 1 to your basket 2 and 3 are added. But if you buy 2 or 3, the others are not automatically added to your basket.

这样,您可以将产品2和3链接到产品1.如果您将产品1添加到购物篮2和3中。但如果您购买2或3,其他的不会自动添加到您的购物篮中。

You use the type code field to make it easier to identify the product:

您可以使用类型代码字段来更轻松地识别产品:

for example:

  • Type code 1: Normal product
  • 类型代码1:普通产品

  • Type code 2: set
  • 输入代码2:设置

  • Type code 3: Part of set
  • 类型代码3:集合的一部分

Hope this helps. This is just from the top of my head on how you could handle this, you can use type codes and links between the other products for other things.

希望这可以帮助。对于你如何处理这个问题,我只能从头到尾,你可以使用其他产品之间的类型代码和链接。

#1


You do not need to create the extra table, you need to be able to let products have a master product and a add a product type code to the table.

您不需要创建额外的表,您需要能够让产品具有主产品并向表中添加产品类型代码。

That way you could have product 2 and 3 link to product 1. If you add product 1 to your basket 2 and 3 are added. But if you buy 2 or 3, the others are not automatically added to your basket.

这样,您可以将产品2和3链接到产品1.如果您将产品1添加到购物篮2和3中。但如果您购买2或3,其他的不会自动添加到您的购物篮中。

You use the type code field to make it easier to identify the product:

您可以使用类型代码字段来更轻松地识别产品:

for example:

  • Type code 1: Normal product
  • 类型代码1:普通产品

  • Type code 2: set
  • 输入代码2:设置

  • Type code 3: Part of set
  • 类型代码3:集合的一部分

Hope this helps. This is just from the top of my head on how you could handle this, you can use type codes and links between the other products for other things.

希望这可以帮助。对于你如何处理这个问题,我只能从头到尾,你可以使用其他产品之间的类型代码和链接。