在 MySQL 中对价格矩阵表进行建模
我正在尝试创建一个接受打印作业订单的电子商务产品。我想创建诸如solopress上的表格,例如 http://www .solopress.com/leaflet-printing/leaflets.html。我只是在数据库中建模的逻辑步骤上遇到了一些困难。
首先,我将如何创建一个这样的表,其中可以对数据库中的每个产品进行不同的列选项配置,而不必每次都创建实际的数据库表。
其次,当您在“展开”和“折叠”之间进行更改时,最好的工作方式是什么,以便价格发生变化,如上面的示例所示 - 这是否需要两个独立的表格进行切换?
I am trying to create an ecommerce product that takes orders for print jobs. I would like to create tables such as the ones here on solopress for example http://www.solopress.com/leaflet-printing/leaflets.html. I am just struggling a little with the logical steps of modelling this in a database.
Firstly how would I go about creating a table like that where the column options could be configured differently per product in a database without having to create an actual database table each time.
Secondly then what would be the best way to work it so that the prices change as in the example above, when you change between Unfolded and Folded - would this need to be two independent tables that get switched?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了存储价格,我将像这样构造表:
主键是 size+min_qty+sides+folded。
生成网页将涉及 PHP 或类似的内容,并且在选择选项时更新价格将涉及 JavaScript。如果您对这些问题有具体问题,可能应该单独询问。
For storing the prices I'd structure the table like this:
with your primary key being size+min_qty+sides+folded.
Generating the webpage will involve PHP or similar and updating the price as options are chosen will involve javascript. If you have specific questions about those they should probably be asked separately.