Skip to content

Commit

Permalink
Hide add t cart on tile if using inventory management
Browse files Browse the repository at this point in the history
  • Loading branch information
thms committed Jul 22, 2013
1 parent eab601f commit 25ba0ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions app/views/spree/shared/_products.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@
<%= link_to 'See Details', product %>
<% else %>
<div class="price selling" itemprop="price" style="margin-bottom:6px;"><%= number_to_currency product.price %></div>
<%= form_for :order, :url => populate_orders_url, :remote => true do |f| %>
<%= hidden_field_tag "variants[#{product.master.id}]", 1, :size => 3 %>
<%= hidden_field_tag "source", "tile" %>
<%= link_to t(:add_to_cart), '#', :onclick => "$(this).parent().submit(); return false;", :class => "button add-to-cart", :id => "add_to_cart_sku_#{product.master.sku}" %>
<% if product.brand.brand_owner.title == 'Diageo' %>
<%= javascript_tag do %>
$("#add_to_cart_sku_<%= product.master.sku -%>").on("click", function() {
$(document).trigger("itemAddedToCart", ["<%= product.master.sku -%>", "<%= product.name -%>", "<%= product.brand.title -%>"]);
});
<% end %>
<% end %>
<% if product.has_stock? || Spree::Config[:allow_backorders] %>
<%= form_for :order, :url => populate_orders_url, :remote => true do |f| %>
<%= hidden_field_tag "variants[#{product.master.id}]", 1, :size => 3 %>
<%= hidden_field_tag "source", "tile" %>
<%= link_to t(:add_to_cart), '#', :onclick => "$(this).parent().submit(); return false;", :class => "button add-to-cart", :id => "add_to_cart_sku_#{product.master.sku}" %>
<% if product.brand.brand_owner.title == 'Diageo' %>
<%= javascript_tag do %>
$("#add_to_cart_sku_<%= product.master.sku -%>").on("click", function() {
$(document).trigger("itemAddedToCart", ["<%= product.master.sku -%>", "<%= product.name -%>", "<%= product.brand.title -%>"]);
});
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion spree_reservebar_theme.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_reservebar_theme'
s.version = '0.5.14'
s.version = '0.5.15'
s.summary = 'Spree Commerce Theme for reservebar.com'

s.author = 'Thomas Boltze'
Expand Down

0 comments on commit 25ba0ce

Please sign in to comment.