Sha256: d1e51a874e8fa7c44ae6964a4d9aac1103f6e941918a3dc4031c71be35d5c00f

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

<%= form_for :order, :url => populate_orders_url do |f| %>
  <div data-hook="inside_product_cart_form">

    <% if @product.price %>
      <div data-hook="product_price">
        <dl id="product-price">
          <dt><%= t(:price) %></dt>
          <dd><span class="price selling"><%= number_to_currency @product.price %></span></dd>
        </dl>
      </div>
    <% end %>

    <% if @product.has_variants? %>
      <div id="product-variants">
        <h2><%= t(:variants) %></h2>
        <ul>
          <% has_checked = false
          @product.variants.active.each_with_index do |v,index|
            next if v.option_values.empty? || (!v.in_stock && !Spree::Config[:show_zero_stock_products])
            checked = !has_checked && (v.in_stock || Spree::Config[:allow_backorders])
            has_checked = true if checked %>
            <li>
              <%= radio_button_tag "products[#{@product.id}]", v.id, checked, :disabled => !v.in_stock && !Spree::Config[:allow_backorders] %>
              <label for="<%= ['products', @product.id, v.id].join('_') %>">
                <span class="variant-description">
                  <%= variant_options v %>
                </span>
                <% if variant_price_diff v %>
                  <span class="price diff"><%= variant_price_diff v %></span>
                <% end %>
              </label>
            </li>
          <% end%>
        </ul>
      </div>
    <% end%>
    <% if @product.has_stock? || Spree::Config[:allow_backorders] %>
      <%= number_field_tag (@product.has_variants? ? :quantity : "variants[#{@product.master.id}]"),
        1, :class => 'title', :in => 1..@product.on_hand %>
      &nbsp;
      <%= button_tag :class => 'large primary', :id => 'add-to-cart-button' do %>
        <%= image_tag('icons/add-to-cart.png') + t(:add_to_cart) %>
      <% end %>
    <% else %>
      <%= content_tag('strong', t(:out_of_stock)) %>
    <% end %>

  </div>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_core-1.0.0.rc2 app/views/spree/products/_cart_form.html.erb
spree_core-1.0.0.rc1 app/views/spree/products/_cart_form.html.erb