spree_frontend 2.1.12 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/{store → spree/frontend}/cart.png +0 -0
  3. data/app/assets/images/{store → spree/frontend}/select_arrow.gif +0 -0
  4. data/app/assets/javascripts/spree/frontend.js +5 -0
  5. data/app/assets/javascripts/{store → spree/frontend}/cart.js.coffee +7 -1
  6. data/app/assets/javascripts/spree/frontend/checkout.js.coffee +11 -0
  7. data/app/assets/javascripts/{store/checkout.js.coffee → spree/frontend/checkout/address.js.coffee} +12 -40
  8. data/app/assets/javascripts/spree/frontend/checkout/payment.js.coffee +64 -0
  9. data/app/assets/javascripts/{store → spree/frontend}/product.js.coffee +2 -3
  10. data/app/assets/stylesheets/{store/spree_frontend.css → spree/frontend.css} +1 -1
  11. data/app/assets/stylesheets/{store → spree/frontend}/_variables.scss +0 -0
  12. data/app/assets/stylesheets/{store → spree/frontend}/screen.css.scss +37 -4
  13. data/app/controllers/spree/checkout_controller.rb +2 -44
  14. data/app/controllers/spree/content_controller.rb +1 -6
  15. data/app/controllers/spree/home_controller.rb +1 -0
  16. data/app/controllers/spree/orders_controller.rb +14 -25
  17. data/app/controllers/spree/products_controller.rb +5 -22
  18. data/app/controllers/spree/store_controller.rb +23 -0
  19. data/app/controllers/spree/taxons_controller.rb +1 -0
  20. data/app/views/spree/checkout/_address.html.erb +2 -0
  21. data/app/views/spree/checkout/_delivery.html.erb +1 -1
  22. data/app/views/spree/checkout/_payment.html.erb +4 -6
  23. data/app/views/spree/checkout/_summary.html.erb +41 -15
  24. data/app/views/spree/checkout/edit.html.erb +6 -2
  25. data/app/views/spree/checkout/payment/_gateway.html.erb +7 -3
  26. data/app/views/spree/content/test.html.erb +1 -0
  27. data/app/views/spree/home/index.html.erb +3 -1
  28. data/app/views/spree/orders/_adjustment_row.html.erb +6 -0
  29. data/app/views/spree/orders/_adjustments.html.erb +19 -9
  30. data/app/views/spree/orders/_form.html.erb +13 -1
  31. data/app/views/spree/orders/_line_item.html.erb +1 -1
  32. data/app/views/spree/orders/edit.html.erb +14 -18
  33. data/app/views/spree/payments/_payment.html.erb +15 -0
  34. data/app/views/spree/products/_cart_form.html.erb +11 -10
  35. data/app/views/spree/products/index.html.erb +3 -1
  36. data/app/views/spree/products/show.html.erb +34 -32
  37. data/app/views/spree/shared/_frontend_routes.html.erb +3 -0
  38. data/app/views/spree/shared/_google_analytics.html.erb +7 -7
  39. data/app/views/spree/shared/_head.html.erb +3 -2
  40. data/app/views/spree/shared/_link_to_cart.html.erb +1 -0
  41. data/app/views/spree/shared/_main_nav_bar.html.erb +7 -1
  42. data/app/views/spree/shared/_order_details.html.erb +40 -14
  43. data/app/views/spree/shared/_products.html.erb +8 -5
  44. data/app/views/spree/shared/_search.html.erb +6 -4
  45. data/app/views/spree/shared/_taxonomies.html.erb +5 -3
  46. data/app/views/spree/store/cart_link.html.erb +1 -0
  47. data/app/views/spree/taxons/show.html.erb +6 -5
  48. data/config/routes.rb +1 -0
  49. data/lib/spree/frontend.rb +0 -7
  50. data/lib/spree/frontend/engine.rb +1 -2
  51. data/lib/spree/frontend/preference_rescue.rb +25 -0
  52. metadata +25 -16
  53. data/app/assets/javascripts/store/spree_frontend.js +0 -5
@@ -1,8 +1,6 @@
1
1
  module Spree
2
2
  class ProductsController < Spree::StoreController
3
3
  before_filter :load_product, :only => :show
4
- before_filter :load_taxon, :only => :index
5
-
6
4
  rescue_from ActiveRecord::RecordNotFound, :with => :render_404
7
5
  helper 'spree/taxons'
8
6
 
@@ -11,6 +9,7 @@ module Spree
11
9
  def index
12
10
  @searcher = build_searcher(params)
13
11
  @products = @searcher.retrieve_products
12
+ @taxonomies = Spree::Taxonomy.includes(root: :children)
14
13
  end
15
14
 
16
15
  def show
@@ -18,20 +17,7 @@ module Spree
18
17
 
19
18
  @variants = @product.variants_including_master.active(current_currency).includes([:option_values, :images])
20
19
  @product_properties = @product.product_properties.includes(:property)
21
-
22
- referer = request.env['HTTP_REFERER']
23
- if referer
24
- begin
25
- referer_path = URI.parse(request.env['HTTP_REFERER']).path
26
- # Fix for #2249
27
- rescue URI::InvalidURIError
28
- # Do nothing
29
- else
30
- if referer_path && referer_path.match(/\/t\/(.*)/)
31
- @taxon = Spree::Taxon.find_by_permalink($1)
32
- end
33
- end
34
- end
20
+ @taxon = Spree::Taxon.find(params[:taxon_id]) if params[:taxon_id]
35
21
  end
36
22
 
37
23
  private
@@ -41,14 +27,11 @@ module Spree
41
27
 
42
28
  def load_product
43
29
  if try_spree_current_user.try(:has_spree_role?, "admin")
44
- @product = Product.with_deleted.find_by_permalink!(params[:id])
30
+ @products = Product.with_deleted
45
31
  else
46
- @product = Product.active(current_currency).find_by_permalink!(params[:id])
32
+ @products = Product.active(current_currency)
47
33
  end
48
- end
49
-
50
- def load_taxon
51
- @taxon = Spree::Taxon.find(params[:taxon]) if params[:taxon].present?
34
+ @product = @products.friendly.find(params[:id])
52
35
  end
53
36
  end
54
37
  end
@@ -6,7 +6,30 @@ module Spree
6
6
  render 'spree/shared/unauthorized', :layout => Spree::Config[:layout], :status => 401
7
7
  end
8
8
 
9
+ def cart_link
10
+ render :partial => 'spree/shared/link_to_cart'
11
+ fresh_when(simple_current_order)
12
+ end
13
+
9
14
  protected
15
+ # This method is placed here so that the CheckoutController
16
+ # and OrdersController can both reference it (or any other controller
17
+ # which needs it)
18
+ def apply_coupon_code
19
+ if params[:order] && params[:order][:coupon_code]
20
+ @order.coupon_code = params[:order][:coupon_code]
21
+
22
+ handler = PromotionHandler::Coupon.new(@order).apply
23
+
24
+ if handler.error.present?
25
+ flash.now[:error] = handler.error
26
+ respond_with(@order) { |format| format.html { render :edit } } and return
27
+ elsif handler.success
28
+ flash[:success] = handler.success
29
+ end
30
+ end
31
+ end
32
+
10
33
  def config_locale
11
34
  Spree::Frontend::Config[:locale]
12
35
  end
@@ -11,6 +11,7 @@ module Spree
11
11
 
12
12
  @searcher = build_searcher(params.merge(:taxon => @taxon.id))
13
13
  @products = @searcher.retrieve_products
14
+ @taxonomies = Spree::Taxonomy.includes(root: :children)
14
15
  end
15
16
 
16
17
  private
@@ -20,8 +20,10 @@
20
20
  </fieldset>
21
21
  </div>
22
22
  <hr class="clear" />
23
+
23
24
  <div class="form-buttons" data-hook="buttons">
24
25
  <%= submit_tag Spree.t(:save_and_continue), :class => 'continue button primary' %>
26
+
25
27
  <span data-hook="save_user_address">
26
28
  &nbsp; &nbsp;
27
29
  <%= check_box_tag 'save_user_address', '1', try_spree_current_user.respond_to?(:persist_order_address) %>
@@ -37,7 +37,7 @@
37
37
 
38
38
  <h5 class="stock-shipping-method-title"><%= Spree.t(:shipping_method) %></h5>
39
39
  <ul class="field radios shipping-methods">
40
- <% ship_form.object.shipping_rates.each do |rate| %>
40
+ <% ship_form.object.shipping_rates.with_shipping_method.each do |rate| %>
41
41
  <li class="shipping-method">
42
42
  <label>
43
43
  <%= ship_form.radio_button :selected_shipping_rate_id, rate.id %>
@@ -22,12 +22,10 @@
22
22
  <% end %>
23
23
  </ul>
24
24
  <br style="clear:both;" />
25
- <% if Spree::Promotion.with_code.count > 0 %>
26
- <p class='field' data-hook='coupon_code'>
27
- <%= form.label :coupon_code %><br />
28
- <%= form.text_field :coupon_code %>
29
- </p>
30
- <% end %>
25
+ <p class='field' data-hook='coupon_code'>
26
+ <%= form.label :coupon_code %><br />
27
+ <%= form.text_field :coupon_code %>
28
+ </p>
31
29
  </div>
32
30
  </fieldset>
33
31
 
@@ -6,28 +6,54 @@
6
6
  <td><strong><%= Spree.t(:item_total) %>:</strong></td>
7
7
  <td><strong><%= order.display_item_total.to_html %></strong></td>
8
8
  </tr>
9
- <tbody id="summary-order-charges" data-hook>
10
- <% order.adjustments.eligible.each do |adjustment| %>
11
- <% next if (adjustment.originator_type == 'Spree::TaxRate') and (adjustment.amount == 0) %>
12
- <tr>
13
- <td><%= adjustment.label %>: </td>
14
- <td><%= adjustment.display_amount.to_html %></td>
9
+
10
+ <% if order.line_item_adjustments.exists? %>
11
+ <tbody data-hook="order_details_promotion_adjustments">
12
+ <% order.line_item_adjustments.promotion.eligible.group_by(&:label).each do |label, adjustments| %>
13
+ <tr class="total">
14
+ <td><%= label %></td>
15
+ <td><%= Spree::Money.new(adjustments.sum(&:amount)).to_html %></td>
16
+ </tr>
17
+ <% end %>
18
+ </tbody>
19
+ <% end %>
20
+
21
+ <tbody data-hook="order_details_tax_adjustments">
22
+ <% order.all_adjustments.tax.eligible.group_by(&:label).each do |label, adjustments| %>
23
+ <tr class="total">
24
+ <td><%= label %></td>
25
+ <td><%= Spree::Money.new(adjustments.sum(&:amount)).to_html %></td>
15
26
  </tr>
16
27
  <% end %>
17
28
  </tbody>
18
- <tr data-hook="order_total">
19
- <td><strong><%= Spree.t(:order_total) %>:</strong></td>
20
- <td><strong><span id='summary-order-total'><%= order.display_total.to_html %></span></strong></td>
21
- </tr>
22
- <% if order.line_item_adjustment_totals.present? %>
23
- <tbody id="price-adjustments" data-hook="order_details_price_adjustments">
24
- <% order.line_item_adjustment_totals.each do |label, total| %>
29
+
30
+ <% if order.checkout_steps.include?("delivery") %>
31
+ <tr data-hook="shipping_total">
32
+ <% if order.shipment_total > 0 %>
33
+ <td><%= Spree.t(:shipping_total) %></td>
34
+ <td><%= Spree::Money.new(order.shipment_total).to_html %></td>
35
+ <% else %>
36
+ <td><strong><%= Spree.t(:free_shipping) %></strong></td>
37
+ <td><%= Spree.t(:free_shipping_amount) %></td>
38
+ <% end %>
39
+ </tr>
40
+ <% end %>
41
+
42
+ <% if order.adjustments.eligible.exists? %>
43
+ <tbody id="summary-order-charges" data-hook>
44
+ <% order.adjustments.eligible.each do |adjustment| %>
45
+ <% next if (adjustment.source_type == 'Spree::TaxRate') and (adjustment.amount == 0) %>
25
46
  <tr class="total">
26
- <td><strong><%= label %></strong></td>
27
- <td><strong><span><%= total.to_html %></span></strong></td>
47
+ <td><%= adjustment.label %>: </td>
48
+ <td><%= adjustment.display_amount.to_html %></td>
28
49
  </tr>
29
50
  <% end %>
30
51
  </tbody>
31
52
  <% end %>
53
+
54
+ <tr data-hook="order_total">
55
+ <td><strong><%= Spree.t(:order_total) %>:</strong></td>
56
+ <td><strong><span id='summary-order-total'><%= order.display_total.to_html %></span></strong></td>
57
+ </tr>
32
58
  </tbody>
33
59
  </table>
@@ -24,9 +24,13 @@
24
24
  </div>
25
25
  <% end %>
26
26
  </div>
27
-
28
27
  </div>
29
28
 
29
+ <script>
30
+ Spree.current_order_id = "<%= @order.number %>"
31
+ Spree.current_order_token = "<%= @order.token %>"
32
+ </script>
33
+
30
34
  <% if I18n.locale != :en %>
31
- <script src="<%= assets_prefix %>/jquery.validate/localization/messages_<%= I18n.locale.to_s.downcase.gsub("-", "") %>.js"></script>
35
+ <script src="<%= assets_prefix %>/jquery.validate/localization/messages_<%= I18n.locale %>.js"></script>
32
36
  <% end %>
@@ -1,6 +1,11 @@
1
1
  <%= image_tag 'credit_cards/credit_card.gif', :id => 'credit-card-image' %>
2
2
  <% param_prefix = "payment_source[#{payment_method.id}]" %>
3
3
 
4
+ <p class="field">
5
+ <%= label_tag "name_on_card_#{payment_method.id}", Spree.t(:name_on_card) %><span class="required">*</span><br />
6
+ <%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}"} %>
7
+ </p>
8
+
4
9
  <p class="field" data-hook="card_number">
5
10
  <%= label_tag "card_number", Spree.t(:card_number) %><span class="required">*</span><br />
6
11
  <% options_hash = Rails.env.production? ? {:autocomplete => 'off'} : {} %>
@@ -12,10 +17,12 @@
12
17
  )
13
18
  </span>
14
19
  </p>
20
+
15
21
  <p class="field" data-hook="card_expiration">
16
22
  <%= label_tag "card_expiry", Spree.t(:expiration) %><span class="required">*</span><br />
17
23
  <%= text_field_tag "#{param_prefix}[expiry]", '', :id => 'card_expiry', :class => "required cardExpiry", :placeholder => "MM / YY" %>
18
24
  </p>
25
+
19
26
  <p class="field" data-hook="card_code">
20
27
  <%= label_tag "card_code", Spree.t(:card_code) %><span class="required">*</span><br />
21
28
  <%= text_field_tag "#{param_prefix}[verification_value]", '', options_hash.merge(:id => 'card_code', :class => 'required cardCode', :size => 5) %>
@@ -23,6 +30,3 @@
23
30
  </p>
24
31
 
25
32
  <%= hidden_field_tag "#{param_prefix}[cc_type]", '', :id => "cc_type", :class => 'ccType' %>
26
-
27
- <%= hidden_field param_prefix, 'first_name', :value => @order.billing_firstname %>
28
- <%= hidden_field param_prefix, 'last_name', :value => @order.billing_lastname %>
@@ -0,0 +1 @@
1
+ Nothing to see here. Move along now.
@@ -5,6 +5,8 @@
5
5
  <% end %>
6
6
 
7
7
  <div data-hook="homepage_products">
8
- <%= render :partial => 'spree/shared/products', :locals => { :products => @products } %>
8
+ <% cache(cache_key_for_products) do %>
9
+ <%= render :partial => 'spree/shared/products', :locals => { :products => @products } %>
10
+ <% end %>
9
11
  </div>
10
12
 
@@ -0,0 +1,6 @@
1
+ <tr class="adjustment">
2
+ <td colspan="4" align='right'><h5><%= type %>: <%= label %></h5></td>
3
+ <td colspan='2'>
4
+ <h5><%= Spree::Money.new(adjustments.sum(&:amount), :currency => @order.currency) %></h5>
5
+ </td>
6
+ </tr>
@@ -1,14 +1,24 @@
1
- <thead>
2
- <tr data-hook="cart_adjustments_headers">
3
- <th class="cart-adjustment-header" colspan="6"><%= Spree.t(:order_adjustments) %></th>
4
- </tr>
5
- </thead>
6
1
  <tbody id="cart_adjustments" data-hook>
7
- <% @order.adjustments.eligible.each do |adjustment| %>
2
+ <% if @order.line_item_adjustments.exists? %>
3
+ <% @order.line_item_adjustments.promotion.eligible.group_by(&:label).each do |label, adjustments| %>
4
+ <%= render "spree/orders/adjustment_row", :label => label, :adjustments => adjustments, :type => Spree.t(:promotion) %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <% @order.all_adjustments.tax.eligible.group_by(&:label).each do |label, adjustments| %>
9
+ <%= render "spree/orders/adjustment_row", :label => label, :adjustments => adjustments, :type => Spree.t(:tax) %>
10
+ <% end %>
11
+
12
+ <% @order.shipments.each do |shipment| %>
8
13
  <tr>
9
- <td colspan="4"><%= adjustment.label %></td>
10
- <td><%= adjustment.display_amount.to_html %></td>
11
- <td></td>
14
+ <td colspan="4" align='right'><h5><%= Spree.t(:shipping) %>: <%= shipment.shipping_method.name %></h5></td>
15
+ <td colspan='2'>
16
+ <h5><%= shipment.display_discounted_cost %></h5>
17
+ </td>
12
18
  </tr>
13
19
  <% end %>
20
+
21
+ <% @order.adjustments.eligible.group_by(&:label).each do |label, adjustments| %>
22
+ <%= render "spree/orders/adjustment_row", :label => label, :adjustments => adjustments, :type => Spree.t(:adjustment) %>
23
+ <% end %>
14
24
  </tbody>
@@ -12,5 +12,17 @@
12
12
  <tbody id="line_items" data-hook>
13
13
  <%= render partial: 'line_item', collection: order_form.object.line_items, locals: {order_form: order_form} %>
14
14
  </tbody>
15
- <%= render "spree/orders/adjustments" unless @order.adjustments.eligible.blank? %>
15
+ <% if @order.adjustments.exists? || @order.line_item_adjustments.exists? || @order.shipment_adjustments.exists? %>
16
+ <tr class="cart-subtotal">
17
+ <td colspan="4" align='right'><h5><%= Spree.t(:cart_subtotal, :count => @order.line_items.sum(:quantity)) %></h5></th>
18
+ <td colspan><h5><%= order_form.object.display_item_total %></h5></td>
19
+ <td></td>
20
+ </tr>
21
+ <%= render "spree/orders/adjustments" %>
22
+ <% end %>
23
+ <tr class="cart-total">
24
+ <td colspan="4" align='right'><h5><%= Spree.t(:total) %></h5></th>
25
+ <td colspan><h5><%= order_form.object.display_total %></h5></td>
26
+ <td></td>
27
+ </tr>
16
28
  </table>
@@ -11,7 +11,7 @@
11
11
  <td class="cart-item-description" data-hook="cart_item_description">
12
12
  <h4><%= link_to line_item.name, product_path(variant.product) %></h4>
13
13
  <%= variant.options_text %>
14
- <% if line_item.insufficient_stock? %>
14
+ <% if @order.insufficient_stock_lines.include? line_item %>
15
15
  <span class="out-of-stock">
16
16
  <%= Spree.t(:out_of_stock) %>&nbsp;&nbsp;<br />
17
17
  </span>
@@ -18,31 +18,27 @@
18
18
  <%= render :partial => 'form', :locals => { :order_form => order_form } %>
19
19
  </div>
20
20
 
21
- <div id="subtotal" data-hook class="columns sixteen alpha omega">
22
- <h5><%= Spree.t(:subtotal) %>: <span class="order-total"><%= @order.display_total.to_html %></span></h5>
23
- </div>
24
-
25
- <div class="links columns sixteen alpha omega" data-hook="cart_buttons">
26
- <%= order_form.text_field :coupon_code, :size => 10, :placeholder => Spree.t(:coupon_code) %>
27
- <%= button_tag :class => 'primary', :id => 'update-button' do %>
28
- <%= Spree.t(:update) %>
29
- <% end %>
30
- <%= button_tag :class => 'button checkout primary', :id => 'checkout-link', :name => 'checkout' do %>
31
- <%= Spree.t(:checkout) %>
32
- <% end %>
33
- </div>
21
+ <div class="links columns sixteen alpha omega" data-hook="cart_buttons">
22
+ <%= order_form.text_field :coupon_code, :size => 10, :placeholder => Spree.t(:coupon_code) %>
23
+ <%= button_tag :class => 'primary', :id => 'update-button' do %>
24
+ <%= Spree.t(:update) %>
25
+ <% end %>
26
+ <%= button_tag :class => 'button checkout primary', :id => 'checkout-link', :name => 'checkout' do %>
27
+ <%= Spree.t(:checkout) %>
28
+ <% end %>
34
29
  </div>
35
30
  </div>
36
31
  <% end %>
32
+ </div>
37
33
 
38
34
  <div id="empty-cart" data-hook>
39
35
  <%= form_tag empty_cart_path, :method => :put do %>
40
36
  <p id="clear_cart_link" data-hook>
41
- <%= submit_tag Spree.t(:empty_cart), :class => 'button gray' %>
42
- <%= Spree.t(:or) %>
43
- <%= link_to Spree.t(:continue_shopping), products_path, :class => 'continue button gray' %>
44
- </p>
45
- <% end %>
37
+ <%= submit_tag Spree.t(:empty_cart), :class => 'button gray' %>
38
+ <%= Spree.t(:or) %>
39
+ <%= link_to Spree.t(:continue_shopping), products_path, :class => 'continue button gray' %>
40
+ </p>
41
+ <% end %>
46
42
  </div>
47
43
 
48
44
  <% end %>
@@ -0,0 +1,15 @@
1
+ <% source = payment.source %>
2
+ <% if source.is_a?(Spree::CreditCard) %>
3
+ <span class="cc-type">
4
+ <% unless (cc_type = source.cc_type).blank? %>
5
+ <%= image_tag "credit_cards/icons/#{cc_type}.png" %>
6
+ <% end %>
7
+ <% if source.last_digits %>
8
+ <%= Spree.t(:ending_in) %> <%= source.last_digits %>
9
+ <% end %>
10
+ </span>
11
+ <br />
12
+ <span class="full-name"><%= source.name %></span>
13
+ <% else %>
14
+ <%= content_tag(:span, payment.payment_method.name) %>
15
+ <% end %>
@@ -7,24 +7,26 @@
7
7
  <ul>
8
8
  <% @product.variants_and_option_values(current_currency).each_with_index do |variant, index| %>
9
9
  <li>
10
- <%= radio_button_tag "products[#{@product.id}]", variant.id, index == 0, 'data-price' => variant.price_in(current_currency).money %>
11
- <label for="<%= ['products', @product.id, variant.id].join('_') %>">
10
+ <%= radio_button_tag "variant_id", variant.id, index == 0, 'data-price' => Spree::Money.new(variant.price, with_currency: true).to_s %>
11
+ <%= label_tag "variant_id" do %>
12
12
  <span class="variant-description">
13
13
  <%= variant_options variant %>
14
14
  </span>
15
15
  <% if variant_price variant %>
16
16
  <span class="price diff"><%= variant_price variant %></span>
17
17
  <% end %>
18
- </label>
18
+ <% end %>
19
19
  </li>
20
20
  <% end%>
21
21
  </ul>
22
22
  </div>
23
- <% end%>
23
+ <% else %>
24
+ <%= hidden_field_tag "variant_id", @product.master.id %>
25
+ <% end %>
24
26
 
25
27
  <% if @product.price_in(current_currency) and !@product.price.nil? %>
26
28
  <div data-hook="product_price" class="columns five <% if !@product.has_variants? %> alpha <% else %> omega <% end %>">
27
-
29
+
28
30
  <div id="product-price">
29
31
  <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
30
32
  <div>
@@ -34,14 +36,13 @@
34
36
  <span itemprop="priceCurrency" content="<%= @product.currency %>"></span>
35
37
  </div>
36
38
 
37
- <% if @product.master.in_stock? %>
39
+ <% if @product.master.can_supply? %>
38
40
  <link itemprop="availability" href="http://schema.org/InStock" />
39
- <% end %>
41
+ <% end %>
40
42
  </div>
41
43
 
42
44
  <div class="add-to-cart">
43
- <%= number_field_tag (@product.variants_and_option_values.any? ? :quantity : "variants[#{@product.master.id}]"),
44
- 1, :class => 'title', :min => 1 %>
45
+ <%= number_field_tag :quantity, 1, :class => 'title', :min => 1 %>
45
46
  <%= button_tag :class => 'large primary', :id => 'add-to-cart-button', :type => :submit do %>
46
47
  <%= Spree.t(:add_to_cart) %>
47
48
  <% end %>
@@ -52,6 +53,6 @@
52
53
  <br>
53
54
  <div><span class="price selling" itemprop="price"><%= Spree.t('product_not_available_in_this_currency') %></span></div>
54
55
  </div>
55
- <% end %>
56
+ <% end %>
56
57
  </div>
57
58
  <% end %>