<%= form_for([:vendor, @product] , :html => { class: 'form-horizontal', :multipart => true }) do |f| %> <%= render partial: 'form_errors', locals: { what: @product } %>
<%= f.label :title, 'Product title', class: 'col-sm-2 control-label' %>
<%= f.text_field :title, class: 'form-control' %>
<%= f.label :description, class: 'col-sm-2 control-label' %>
<%= f.text_area :description, rows: 10, class: 'form-control' %>
<%= f.label :category_id, 'Category' , class: 'col-sm-2 control-label' %>
<%= f.collection_select(:category_id, Category.all, :id, :name, {}, class: 'form-control') %>
<%= f.label :available_for_sale, 'Enabled', class: 'col-sm-2 control-label' %>
<%= f.check_box(:available_for_sale, class: 'checkbox') %>

Allows new sales to be enabled or disabled. Product will remain in listings either way.

<%= f.label :hidden, class: 'col-sm-2 control-label' %>
<%= f.check_box(:hidden, class: 'checkbox') %>

Hide product from product listings and searches.

<% if current_user.fe_allowed %>
<%= f.label :fe_enabled, 'No escrow', class: 'col-sm-2 control-label' %>
<%= f.check_box(:fe_enabled, class: 'checkbox') %>

No escrow tag will show on product listing and buyer will be advised during order confirmation that no escrow will be held. No escrow (finalize early) orders will be automatically finalized by the market upon vendor acceptance.

<%end%>
<%= f.label :image1, "Product image 1", class: 'col-sm-2 control-label' %>
<%= image_tag @product.image1.url(:thumb), class: 'thumbnail', alt: 'product image1' %> <%= f.file_field :image1 %>

Max size 2MB per image (gif, jpeg, png). The server will strip exif but it is safer to remove exif yourself before upload. Beware of sensor fingerprinting. To avoid timeouts on the slow TOR network, it may be preferable to upload one image at a time.

<% if @product.image1_file_name %>
<%= check_box_tag('delete_image[]', 1, false, id: 'delete_image1') %> Delete image 1
<%end%>
<%= f.label :image2, "Product image 2", class: 'col-sm-2 control-label' %>
<%= image_tag @product.image2.url(:thumb), class: 'thumbnail', alt: 'product image2' %> <%= f.file_field :image2 %> <% if @product.image2_file_name %>
<%= check_box_tag('delete_image[]', 2, false, id: 'delete_image2') %> Delete image 2
<%end%>
<%= f.label :image3, "Product image 3", class: 'col-sm-2 control-label' %>
<%= image_tag @product.image3.url(:thumb), class: 'thumbnail', alt: 'product image3' %> <%= f.file_field :image3 %> <% if @product.image3_file_name %>
<%= check_box_tag('delete_image[]', 3, false, id: 'delete_image3') %> Delete image 3
<%end%>
<%# When product first created, make image1 the primary image automatically and don't provide a way to set primary image. Changing the primary image is only necessary for existing products that have at least two images. %> <% unless @product.new_record? %> <% if @product.image_set_array.size > 1 %>
<%= f.label :primary_image, "Primary image", class: 'col-sm-2 control-label' %>
<%# re-sort to numeric order because looks better. %> <% @product.image_set_array.sort.each do |i| %>
<%end%>

Changes the display order of images.

<%end%> <%end%>
<%= f.label :unitdesc, "Units", class: 'col-sm-2 control-label' %>
<%= f.text_field :unitdesc, class: 'form-control' %>

unit description. ie mg, g, oz, ml, cookies.

<%= f.label :stock, class: 'col-sm-2 control-label' %>
<%= f.text_field :stock, class: 'form-control' %>

quantity of product available in specified units

<%= f.fields_for :unitprices do |upform| %>
Unit price
quantity <%= upform.text_field :unit, class: 'form-control input-sm' %>
$ <%= upform.text_field :price, class: 'form-control input-sm' %>
<% unless @product.new_record? %> <%= upform.check_box :_destroy %> Delete <% end %>
<% end %>

At least one unit price should be specified. Others may be left blank. On submission, prices will be saved your preferred currency in account settings.

<%= f.label :from_location_id, 'Ships from' , class: 'col-sm-2 control-label' %>
<%= f.collection_select(:from_location_id, Location.all, :id, :description, {}, class: 'form-control') %>
Ships to
<% Location.all.each do |loc| %>
<% end %>
<%# multi-selects are ugly without javascript styling so use check boxes instead. Both these methods submit an array of shipping ids. Rails automatically handles the join table when product saved. %> <%# f.collection_select(:shippingoption_ids, @shippingoptions, :id, :description, {}, :multiple => true) %>
Shipping options
<% current_user.shippingoptions.each do |shipopt| %>
<% end %>
Payment methods
<% PaymentMethod.all.each do |pm| %>
<% end %>
<%= f.submit class: 'btn btn-primary' %>
<% end %>