基于产品类型的表单 [英] Form based on Product Types

查看:176
本文介绍了基于产品类型的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在亚马逊有卖家帐户,或曾经碰巧看过他们的产品上传表单,我相信您一定注意到,对于您希望上传的每种产品类型,他们的表单都有细微差别。

b
$ b

如果您想要销售Table Fans,那么您会看到这个表单



这两种形式都不同,但它们的作用相同,即上传产品(其中包含一些常见的特定属性)



这个设计令我感兴趣的是,认为最终用户,一个外行人,不会被期望理解产品属性或其用途等术语。你给他一个产品特定的上传表格,他会根据需要填写它。



看一些其他的购物车,例如opencart





opencart具有所有产品类型的一种形式,如果您需要添加



(这是opencart根据需要添加属性)

/ p>



我喜欢亚马逊(以及一些其他电子商务网站,我相信ebay也是亚马逊)这样做了。



我希望为我的项目复制这个,但说实话我从来没有之前看过这个。我甚至不明白你说这个是什么。我尝试在谷歌搜索基于产品类型的表单,并且找不到任何东西来帮助我。



您可以让我知道亚马逊或eBay是如何做到这一点的。

解决方案

有很多不同的实现方法。一般来说,你可能无法单独做HTML和Javascript的复杂事情,你需要一个数据库和一些脚本语言,比如PHP或Ruby在你的服务器上动态生成页面。



我不清楚你想使用哪种语言,所以我会给出一个大致的描述:



开后端,在数据库中我会为一般产品创建一张表。该表格将具有产品类型的字段。然后,我将为特定产品类型创建附加表格,并使这些表格存储所有附加字段以及主要常规产品表格中引用该条目的主键。然后,我将创建一个产品类型表,其中产品ID在常规产品表中的字段中使用,第二个字段引用数据库中存储此类产品的表的名称。



所有类型的产品之间都有相同的代码,我会参考一般产品表。然后,我将允许用户指定产品类型,并在单击该产品类型时,将用户发送到将运行脚本的新页面。该脚本将查询数据库以检索该数据类型的表名,然后查询数据库以获取对该数据类型特定的附加字段的描述,并显示基于数据库返回结果动态生成的适当表单。


If you have a seller accounts at amazon or ever happened to look at their product upload form, I am sure you must have noticed that for each product type you wish to upload they have a slightly different form.

If you want to sell Table Fans, you are presented with this form

and in case you wish to sell shirts, this is what is presented you.

both forms are different yet do the same thing, i.e. upload products (which has some common and few specific attributes)

What intrigues me about this design is the thought that the end user, a layman, wouldn't be expected to understand jargon like product attributes or its use. You give him a product specific upload form and he will fill it up as necessary.

Looking at a few other carts, take for instance opencart

opencart has one form for all product types and if you need to add a few extra attributes it lays the onus on you (the end user) to first understand what attributes are then work as needed.

(this is opencart's add attributes as needed)

I like the way amazon (and a few other ecommerce site, I believe ebay too does as amazon) worked this up.

I wish to replicate this for my project but honestly speaking I have never seen this before. I do not even understand what do you call this. I tried searching google for "form based on product type" and could not find anything to help me.

Can you please let me know how amazon or ebay do this.

解决方案

There are many different ways of implementing this. In general, you probably won't be able to do something this complicated with HTML and Javascript alone, you'll need a database and some sort of scripting language like PHP or Ruby on your server to dynamically generate the pages.

It's not clear to me what languages you'd want to use, so I'll give a general description:

On the back-end, in a database I'd create a table for the general product. This table would have a field for product type. Then I would create additional tables for the specific product types, and have these tables store all the additional fields, and the primary key referencing the entry in the main, general product table. I would then create a table for product type, which has the product ID's used in the field in the general product table, and a second field referencing the name of the table in the database that stores this type of product.

The code that is all in common between all types of products, I would have reference the general product table. I would then allow the user to specify the product type, and when this is clicked, send the user to a new page, which would run a script. The script would query the database to retrieve the table name for that data type, and then query the database for a description of additional fields specific to that data type, and display an appropriate form, dynamically generated based on what the database returns.

这篇关于基于产品类型的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆