如果有人试图将部分产品添加到购物篮中该怎么办?

发布于 2024-07-30 02:34:41 字数 326 浏览 2 评论 0原文

例如,如果一位顾客“愚蠢”(这里是礼貌的),尝试将 4.6 件商品添加到他们的购物篮中,您会期望看到什么? 或者你会如何处理它。 显然,我们只处理数字量(我们的钢锯上周坏了)。

网上似乎有很多不一致的地方。

  • Amazon 向下舍入 (4.6->4, 1.3->1)
  • FireBox 舍入 (4.6->5, 1.3->1)
  • Ebuyer 忽略输入(无错误)
  • Expansys 从您的购物篮中删除该商品
  • 我假设 某些网站会显示错误

哪个是最好的解决方案

If a customer were "silly" (being polite here) enough to try and add, as an example, 4.6 items to their basket, what would you expect to see? or how would you deal with it. Obviously, we only deal with digital quantities (our hacksaw broke last week).

There seems to be a lot of inconsistence across the web.

  • Amazon Rounds down (4.6->4, 1.3->1)
  • FireBox Rounds (4.6->5, 1.3->1)
  • Ebuyer ignores the input (no error)
  • Expansys removes the item from your basket
  • I'm assuming some site will show an error

Which is the best solution

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

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

发布评论

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

评论(9

靑春怀旧 2024-08-06 02:34:42

嗯,你绝对不应该四舍五入。 无论客户的要求多么愚蠢,您都不应该收取比客户要求更多的材料。

Well, you definitely should never round up. You should not ever bill for more materials than the customer requested, no matter how inane the request.

我要还你自由 2024-08-06 02:34:41

在我看来,如果您的产品是一个购物系统,那么主要目标是销售一些商品是有道理的。 通常客户希望执行尽可能少的操作,因此系统应该预测客户在输入错误的输入时可能想要什么。

  • Amazon 向下舍入 (4.6->4, 1.3->1) - 对我来说最好,因为小数点后的所有内容都可以注定为其他输入;
  • FireBox Rounds (4.6->5, 1.3->1) - 对于我来说,我不喜欢有人想卖给我比我想买的更多的东西,所以“地板”比'圆形的';
  • Ebuyer 忽略输入(没有错误) - 那么您将什么也卖不出去,并且用户需要再次输入一些值;
  • Expansys 从您的购物篮中删除了该商品 - 太糟糕了,现在我需要再次在商店中搜索该商品;
  • 我假设某些网站会显示错误。 - 不错,但需要用户重新输入值;

我将实施亚马逊加上通知用户输入不完全清楚并要求他重新检查该值。 因此,如果系统猜对了,那么用户不需要进行任何更改,但如果他输入错误,他会立即看到它。

您还可以记录所有此类事件,然后进行分析,了解用户第一次输入的内容以及他购买的实际数量。 只是为了好奇...

In my opinion if your product is an shopping system then it makes sense that primary goal is to sell some items. Usually customers want to perform as less actions as possible, so the system should predict what customer could possibly want when typing incorrect inputs.

  • Amazon Rounds down (4.6->4, 1.3->1) - the best for me, because everything after the decimal point can be destined to some other input;
  • FireBox Rounds (4.6->5, 1.3->1) - as for me I don't like when someone want to sell me more than I want to buy, so better 'floor' than 'round';
  • Ebuyer ignores the input (no error) - then you'll sell nothing and user needs to enter some values once again;
  • Expansys removes the item from your basket - terrible, now I need to search for the item in the shop once again;
  • I'm assuming some site will show an error. - not bad but required user to retype value;

I would implemented as Amazon plus informing user that input was not fully clear and asking him to recheck the value. So if the system guessed right then user need to change nothing but if he mistyped he'll see it immediately.

Also you could log all this kind of incidents and then perform an analysis, what user typed for the first time and what was the actual count he bought. Just for curiosity...

萌无敌 2024-08-06 02:34:41
  1. 添加 JavaScript 验证,在用户输入时删除非数字输入

  2. 针对 JavaScript 时的情况实施向后解决方案关闭时,要么显示错误消息,要么对值进行四舍五入,但随后显示一条消息,指出“您的输入已调整”

添加:另请注意,分隔小数部分与整数部分的字符因国家/地区而异。 在美国我相信它是“.”,在欧洲它通常是“,”。 如果您的应用程序针对具有不同数字表示形式的不同国家/地区的客户,那么在应用程序逻辑中实现对这两种字符的支持是有意义的。 否则,一些用户将收到格式错误消息而不知道原因 - 非技术人员通常不知道此格式问题。

  1. Add JavaScript verification that would remove non-numeric input while the user is typing in

  2. Implement backward solution for the situation when JavaScript is off, either display an error message or round the value but then display a message saying "your input has been adjusted"

ADDED: Also be aware that the character that separates the fractional part from the integer one differs from country to country. In US I believe it is '.', in Europe it is usually ','. If your applications is targeted at customers in different countries with varying number representation, it would make sense to implement the support for both characters in your application logic. Otherwise some users will get format error messages without knowing why - non-techie people are often unaware of this format issue.

迷荒 2024-08-06 02:34:41

验证用户输入并仅接受数字字符怎么样?

How about validating the user input and accepting only numeric characters?

£噩梦荏苒 2024-08-06 02:34:41

一种解决方案是提醒用户注意错误的输入,以便他们可以纠正。 根据上下文,四舍五入可能是一个过多的假设。

在金额旁边显示一条错误消息,如下所示:“抱歉,我们无法向您提供 4.6 件商品。请输入整数。” ...或类似的规定。

另一种解决方案是通过限制输入字段仅允许有效输入来避免显示错误消息。 即如果您不想要 4.6 项...仅允许用户能够键入 0-9。 如果用户无法输入错误的内容,那么就没有任何理由显示错误消息。

One solution would be to bring the incorrect input to the user's attention so they can correct it. Rounding can be too much of an assumption depending on the context.

Displaying an error message next to the amount something like this: "I'm sorry, we cannot supply you with 4.6 items. Please enter a whole number." ...or something along those lines.

Another solution would be to avoid displaying error messages by restricting the input field to only allow valid input. ie If you don't want 4.6 items...only allow the user to be able to type 0-9. If the user can't enter incorrect input then there is never any reason to display an error message.

怎樣才叫好 2024-08-06 02:34:41

假设您在这里讨论的是网络应用程序,您可以限制输入框中允许的字符。

或者,IMO 您可以使用微调器 (+/-) 控件来更改数量。

我相信tesco.com 就是这么做的。

Assuming you're talking about a web app here, you can limit the characters allowed in the input box.

Alternatively, IMO you could use spinner (+/-) controls to change the quantity.

I believe tesco.com does this.

我要还你自由 2024-08-06 02:34:41

根据我的观点,最好的解决方案是

  1. 客户输入: 4.6
  2. 提交后值更改为 5(或者如果是 4.4,则四舍五入为 4)
  3. 将显示通知,告诉用户只有整数才有效,并且系统已四舍五入“您的”输入( 4.6) 至 5

The best solution according to me would be

  1. Customer enters: 4.6
  2. Value changes to 5 after submitting (or if 4.4, round it to 4)
  3. Notice is displayed telling the user that only integers are valid and that the system has roundedy "your" input (4.6) to 5
凑诗 2024-08-06 02:34:41

一种解决方案是,当用户关闭允许输入分数的编辑字段时,通知用户他们的选择无效。

一个较小的选择是四舍五入(向下舍入,除非您贪婪地出售 1 件额外的物品),或者完全拒绝输入。

最好的解决方案是首先通过为分数提供滑块或旋转控件以仅选择整数来防止分数。

One solution would be to inform the user that their selection is invalid when they tab off the edit field that's allowed them to enter the fraction.

A lesser option would be to round (down, unless you're greedy to sell 1 extra item), or to reject the input completely.

The best solution is to prevent fractions in the first place by giving them a slider or spin control to select only whole numbers.

追风人 2024-08-06 02:34:41

最后添加服务器端检查总是更安全。

因此,如果输入不是整数值:

  1. 我会将用户重定向到相同的表单。
  2. 我将使用下限值 (4) 设置该字段。
  3. 我会在字段顶部添加一条消息,例如“此字段必须是整数值。可能您想要 4 件该产品吗?”

At the end it's always safer add server side check.

So if the input it's not an integer value:

  1. I will redirect the user to the same form.
  2. I will set the field with the floor value (4).
  3. I will put on top of the field a message like"This field must be an integer value. May be did you want 4 pieces of this product?"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文