<commit_before><%= form_for :order, :url => populate_orders_path do |f| %>
  <div id="inside-product-cart-form" data-hook="inside_product_cart_form" itemprop="offers" itemscope itemtype="http://schema.org/Offer">

    <% if @product.variants_and_option_values_for(current_pricing_options).any? %>
      <% @variants = @product.variants_and_option_values_for(current_pricing_options) %>

      <div id="product-variants" class="columns five alpha">
        <h6 class="product-section-title"><%= Spree.t(:variants) %></h6>

        <!-- spreee custom select instead of radio select boxes -->
        <script>window._spree_variants = <%= @variants.each.inject({}) { |h, v| h[v.id] = flow_price(v); h }.to_json.html_safe %>;</script>
        <select style="min-width: 150px; height: 30px;" name="variant_id" onchange="$('span.price.selling').html(_spree_variants[String(this.value)]);">
        <% @variants.each_with_index do |variant, index| %>
          $('.price.selling')).text(variantPrice)
          <option value="<%= variant.id %>">
            <%= variant_options variant %>
            <% if variant_price variant %> - <%= variant_price variant %><% end %>
            <% unless variant.can_supply? %> - <%= Spree.t(:out_of_stock) %><% end %>
          </option>
        <% end %>
        </select>

      </div>


    <% else %>
      <%= hidden_field_tag "variant_id", @product.master.id %>
    <% end %>

    <% if @product.price_for(current_pricing_options) and !@product.price.nil? %>
      <div data-hook="product_price" class="columns five <%= !@product.has_variants? ? 'alpha' : 'omega' %>">

        <div id="product-price">
          <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
          <div>
            <span class="price selling" itemprop="price">
              <%= display_price(@product) %>
            </span>
            <span itemprop="priceCurrency" content="<%= current_pricing_options.currency %>"></span>
          </div>

          <% if @product.master.can_supply? %>
            <link itemprop="availability" href="http://schema.org/InStock" />
          <% elsif @product.variants.empty? %>
            <br />
            <span class="out-of-stock"><%= Spree.t(:out_of_stock) %></span>
          <% end %>
        </div>

        <div class="add-to-cart">
          <%= number_field_tag :quantity, 1, :class => 'title', :min => 1 %>
          <%= button_tag :class => 'large primary', :id => 'add-to-cart-button', :type => :submit do %>
            <%= Spree.t(:add_to_cart) %>
          <% end %>
        </div>
      </div>
    <% else %>
        <div id="product-price">
          <br>
          <div><span class="price selling" itemprop="price"><%= Spree.t('product_not_available_in_this_currency') %></span></div>
        </div>
    <% end %>
  </div>
<% end %><commit_msg>master: Fixed default value for product - bug<commit_after><%= form_for :order, :url => populate_orders_path do |f| %>
  <div id="inside-product-cart-form" data-hook="inside_product_cart_form" itemprop="offers" itemscope itemtype="http://schema.org/Offer">

    <% if @product.variants_and_option_values_for(current_pricing_options).any? %>
      <% @variants = @product.variants_and_option_values_for(current_pricing_options) %>

      <div id="product-variants" class="columns five alpha">
        <h6 class="product-section-title"><%= Spree.t(:variants) %></h6>

        <select id="variant_select" style="min-width: 150px; height: 30px;" name="variant_id" onchange="$('span.price.selling').html(_spree_variants[String(this.value)]);">
        <% @variants.each_with_index do |variant, index| %>
          $('.price.selling')).text(variantPrice)
          <option value="<%= variant.id %>">
            <%= variant_options variant %>
            <% if variant_price variant %> - <%= variant_price variant %><% end %>
            <% unless variant.can_supply? %> - <%= Spree.t(:out_of_stock) %><% end %>
          </option>
        <% end %>
        </select>

      </div>


    <% else %>
      <%= hidden_field_tag "variant_id", @product.master.id %>
    <% end %>

    <% if @product.price_for(current_pricing_options) and !@product.price.nil? %>
      <div data-hook="product_price" class="columns five <%= !@product.has_variants? ? 'alpha' : 'omega' %>">

        <div id="product-price">
          <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
          <div>
            <span class="price selling" itemprop="price">&nbsp;</span>
            <span itemprop="priceCurrency" content="<%= current_pricing_options.currency %>"></span>
          </div>

          <% if @product.master.can_supply? %>
            <link itemprop="availability" href="http://schema.org/InStock" />
          <% elsif @product.variants.empty? %>
            <br />
            <span class="out-of-stock"><%= Spree.t(:out_of_stock) %></span>
          <% end %>
        </div>

        <div class="add-to-cart">
          <%= number_field_tag :quantity, 1, :class => 'title', :min => 1 %>
          <%= button_tag :class => 'large primary', :id => 'add-to-cart-button', :type => :submit do %>
            <%= Spree.t(:add_to_cart) %>
          <% end %>
        </div>
      </div>
    <% else %>
        <div id="product-price">
          <br>
          <div><span class="price selling" itemprop="price"><%= Spree.t('product_not_available_in_this_currency') %></span></div>
        </div>
    <% end %>
  </div>
<% end %>

<!-- spreee custom select instead of radio select boxes -->
<script>
  window._spree_variants = <%= @variants.each.inject({}) { |h, v| h[v.id] = flow_price(v); h }.to_json.html_safe %>;
  $('span.price.selling').html(_spree_variants[$('#variant_select').val()]  );
</script>
{'fraction_non_alphanumeric': 0.19291201117318435, 'fraction_numerical': 0.003840782122905028, 'mean_word_length': 2.764126149802891, 'pattern_counts': {'":': 0, '<': 148, '<?xml version=': 0, '>': 160, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4929275', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1817, 'n_words': 325}