构建应用以分类/描述产品 - 在规划与执行之间感到不知所措
你好!
我最近开始在一家公司工作,这家公司有大约20,000种外科手术器械。我们现在对所有产品的数据非常杂乱,情况糟糕。我打算来解决这个问题。
我的任务是重新设计网站。作为这个项目的一部分,我正在开发一个应用程序,用来分类和描述所有的产品。我们网站上不直接销售产品,但有一群销售代表和分销商会使用这些信息。
一张图片胜过千言万语,所以这里有一个我制作的图示,展示了我想要实现的目标: https://i.stack.imgur.com/tBnN9.png
我现在正在尝试用CakePHP和MySQL来实现这个目标。我对这两个工具的了解不深,也愿意听听其他的建议。也许有现成的内容管理系统(CMS)可以实现这个功能?或者有什么开源的工具?比如Python和Django?
我在确定合适的数据库结构和代码逻辑方面遇到了困难。我是以新手的身份开始这个项目,希望能成长为中级水平。
如果有任何关于如何应对这个庞大任务的建议,我会非常感激。我已经在规划阶段花了将近4周的时间,现在感觉有点迷失方向,脑袋快要炸了。
谢谢!
8 个回答
首先要关注你的数据库设计,然后再考虑你要使用什么框架。
关于EAV(实体-属性-值),可以看看这个链接:http://decipherinfosys.wordpress.com/2007/01/29/name-value-pair-design/ 如果你真的需要这样做,可以考虑使用PostgreSQL的hstore功能。(自己去搜索一下,我没有权限发链接。)
首先要考虑你的用户。然后和你的用户沟通。这些销售人员在这个领域工作得比你久,他们对库存已经有了自己的分类方式。
他们希望看到什么样的界面呢?你设计的界面应该反映出最常见的使用场景!
他们会以什么方式查询这个数据库?如果在考虑数据库设计之前不先问这些问题,你可能会发现,用户最需要的查询方式恰恰是你没有优化的,那样的话你就得费很多劲才能实现。
在开始考虑数据库结构或使用什么技术之前,确保你对用户的期望有一个直观的了解。
画得不错:)
你有没有对实际的表结构做过一些实验?看起来并不是那么难。这里有个尝试,尽量保持简单。
==products==
id[int]
number[varchar]: unique, ie. #50-334
category_id[int]: has-one relation to category.id
==categories==
// What you call branches in your drawing.
id[int]
parent_id[int]: tree structure
title[varchar]
description[text]
image[varchar]
==attributes==
id[int]
attribute_type_id[int]: has-one relation to attribute_types.id
is_universal[bool]: is this attribute used for _all_ products?
name[varchar]
value[varchar]
==attribute_types==
id[int]
codetag[varchar]: name to identify the attribute type from the code. Each type haves different validation. Some types will maybe be validated using data from helper tables.
title[varchar]
description[text]
==products_has_attributes==
// "Join table" with many-to-many relationship between products and attributes.
id[int]: Optional
product_id[int]: has-one relation to products.id
attribute_id[int]: has-one relation to category.id
==categories_has_attributes==
// "Join table" with many-to-many relationship between categories and attributes.
id[int]: Optional
category_id[int]: has-one relation to products.id
attribute_id[int]: has-one relation to category.id
这是第一版草稿。就当作草稿来看。