狂欢如何在下载Ruby on Rails中显示变体?

Muh*_*jaz 5 ruby ruby-on-rails spree ruby-on-rails-3

我在我的应用程序中使用spree 2.0.0 stable.在产品展示页面上,所有变体都显示为单选按钮.我只想在下拉列表中显示它们.有什么想法吗?

谢谢.

Muh*_*jaz 8

注意:当您在应用程序设计中使用大量设计更改或使用自定义设计时,此解决方案特别实现Spree"模板替换方法".看这里

http://guides.spreecommerce.com/developer/view.html

否则,如果您使用Spree商店的默认设计或微小更改,请使用"deface"方法.

去:

应用程序/视图/大礼包/产品/ _cart.html.erb.并在购物车内部表格中写下以下内容.

<%= select_tag "products[#{@product.id}]",     options_for_select(@product.variants_and_option_values(current_currency).collect{|v| ["#{variant_options(v)}  #{variant_price(v)}", v.id]})%>

#(if you don't have this file(app/views/spree/products/_cart_form.html.erb) go to github spree2.0.0 branch and use it in your product.)
Run Code Online (Sandbox Code Playgroud)

希望这也适合你.

谢谢