0

在我的 Spree 1-3-stable App 中,我使用了一个名为 flexi_variant 的扩展。通过扩展,它使用输入字段来允许用户添加价格更改描述。

我选择了标准计算器“Amount Times Constant”,它几乎可以按预期运行;除了不是使用整个字段作为 obj 来计算数量,它添加每个字母。

这是计算器的样子,也是可疑的行。我尝试更改为计数和其他改写,但似乎没有任何效果。有任何想法吗?

_amount_times_constant.html.erb

<%= javascript_tag do %>
function calculate_amount_times_constant_price(obj) {
  return <%= calculator.preferred_multiplier %> * $(obj).val().length;
}
<% end %>
4

1 回答 1

0

通过更改此行

    return <%= calculator.preferred_multiplier %> * $(obj).val().length;

    return <%= calculator.preferred_multiplier %> * $(obj).length;

这会计算整个字段而不是每个字母。

于 2013-06-28T19:55:20.670 回答