为我的网站建立数据库

发布于 2024-10-20 21:18:57 字数 376 浏览 0 评论 0原文

我需要帮助为我的在线定制西装商店设计数据库。到目前为止,我已经为产品、订单和我的用户/客户创建了表。我认为我需要添加一些表格来在客户进行选择和定制时管理我的购物车。此时,我对如何继续感到有点困惑。我的购物车是否需要保存我的订单表最终将保存的所有信息?从附图中可以看到,订单有订单项目,订单项目有订单项目选项。这样,我可以提取客户想要的每个订单项目,以及每个特定订单的所有自定义项。这是否需要首先在我的购物车中完成,这意味着我基本上必须复制数据库订单部分中的所有表,还是有更好的方法?另外,为了稳健地运行 www.indochino.com 这样的网站,我的数据库应用程序还缺少什么?

感谢所有帮助... 在此处输入图像描述

I need help designing the database for my online custom suit store. So far, i have created the tables for the products, orders, and my users/customers. I think I need to add some tables to manage my shopping cart for customers while they are making their selections and customizing them. At this point, i am a little confused on how to proceed. does my shopping cart need to pretty much hold all the information that my orders tables will hold ultimately? as you can see from the attached image, orders have order items, and order items have order item options. this way, i can pull up each order item that a customer wants, and all of the customizations that go with each particular order. Does this need to first done in my shopping cart, meaning that i would basically have to replicate all of the tables in the orders section of the database, or is there a better way? Also, what else is my database application lacking in order to robustly run a website like www.indochino.com?

All help is appreciated...
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

彼岸花似海 2024-10-27 21:18:57

您应该将 order 表更改为 shopping_cart 表,并从中删除所有送货地址信息。

然后创建一个单独的 order 表,其中包含指向关联购物车的 shopping_cart_id。此订单表应包含已发布订单的所有必要信息,例如送货地址、行项目总金额、税额、订单总金额、发布日期时间等。

我不知道不要认为状态字段是正确的方法,因为购物车不是订单,并且很多订单字段不适用于购物车。这些字段不应采用空值,因为它们是已完成订单所必需的。当需要编写有关此数据的报告时,根据状态字段存储完全不同内容的表是一种负担。

You should change your order table to be a shopping_cart table, and remove all of the shipping address information from it.

Then create a separate order table that includes a shopping_cart_id that points to the associated shopping cart. This order table should include all of the necessary information for a posted order, like shipping address, line-item total amount, tax amount, order total amount, posted-date-time, etc.

I don't think a status field is the correct approach, because a shopping cart is not an order, and lots of order fields are not applicable to a shopping cart. These are fields that should not take a null value, because they are required for a completed order. Tables that store completely different things depending on a status field are a burden when it comes time to write reports on this data.

肩上的翅膀 2024-10-27 21:18:57

我认为您不需要单独的桌子来放置购物车。我只需使用现有的 order/order_item 表来保存购物车信息,然后在订单上添加一个状态字段,其中包含“不完整”、“完整”、“已发货”等值。任何不完整的订单都是呈现为购物车。恕我直言,状态机将是管理订单生命周期的良好选择。

I don't think you need a separate table for a shopping cart. I would just use the existing order/order_item tables to hold the shopping cart information, and then add a status field on order that held values such as "incomplete", "complete", "shipped", etc. Any orders that are incomplete are rendered as the shopping cart. A state machine would be good candidate for managing the lifecycle of the order, IMHO.

夜未央樱花落 2024-10-27 21:18:57

假设您的购物车是一个单独的表,它应该有 orderid 和 userid 作为外键。

Assuming your shopping cart is a separate table, it should have orderid and userid as foreign keys.

羞稚 2024-10-27 21:18:57

如果您在订单表上放置“in_cart bit”列,它会起作用吗?这样,您可以使用相同的表,但在订单尚未最终确定的情况下将 in_cart 设置为 1。

Would it work if you put an "in_cart bit" column on the order table? That way you can use the same tables but set in_cart to 1 where the order is not finalized yet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文