Sha256: c4ff880140cc6a1e3f4e2b283986008c202cb117c8108f98d91fe047277a098b

Contents?: true

Size: 1.87 KB

Versions: 2

Compression:

Stored size: 1.87 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"><%= product_price(@product) %></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] %>
      <%= text_field_tag (@product.has_variants? ? :quantity : "variants[#{@product.master.id}]"),
        1, :class => "title", :size => 3 %>
      &nbsp;
      <button type="submit" class="large primary" id="add-to-cart-button">
        <%= image_tag('icons/add-to-cart.png') + t('add_to_cart') %>
      </button>
    <% 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-0.70.0.rc2 app/views/products/_cart_form.html.erb
spree_core-0.70.RC1 app/views/products/_cart_form.html.erb