1

I am working on an e-commerce website that will sell cloths but also provide a way to book a service, like manicure. I am trying to create a single shopping cart, to which users will add both. The user should have a single shopping cart and a single total to pay for in the end. The problem is how should I store these in the database?

Cloths will have size and colour as params, while the services will have the date and time, when the user wants to get the service. Storing all these parameters in a single table order_items doesn't look too wise, while storing params as a serialized string doesn't feel any better.

What is the most common way of storing this data together?

4

1 回答 1

2

我也在一家电子商务商店工作,我们也遇到了同样的问题。最简单的是分别有一个“cart”和“cart_item”表,其中存储产品之间的共享列,例如:价格、数量等。

然后你有一个表“cart_item_voucher”和“cart_item_product”,它们保存了特定于凭证或产品的详细信息。每个人都将使用“cart_item_id”外键引用“cart_item”。

“cart_item”也将有一个类型字段,您可以从那里区分差异。

于 2013-05-22T11:32:30.120 回答