在狂欢演示(最新版本)中,我尝试在views / spree / home / index.html.erb中使用共享/过滤器而不是共享/分类:
<% content_for :sidebar do %>
<div data-hook="homepage_sidebar_navigation">
<%#= render :partial => 'spree/shared/taxonomies' %>
<%= render :partial => 'spree/shared/filters' %>
</div>
<% end %>
我得到了过滤器(All Taxons),但是当我选择一些,如包和T恤并点击搜索时,过滤器不起作用。
我没有更改共享/过滤器中的任何内容:
<% filters = @taxon ? @taxon.applicable_filters : [Spree::Core::ProductFilters.all_taxons] %>
<% unless filters.empty? %>
<%= form_tag '', :method => :get, :id => 'sidebar_products_search' do %>
<%= hidden_field_tag 'per_page', params[:per_page] %>
<% filters.each do |filter| %>
<% labels = filter[:labels] || filter[:conds].map {|m,c| [m,m]} %>
<% next if labels.empty? %>
<div class="navigation" data-hook="navigation">
<h6 class="filter-title"> <%= filter[:name] %> </h6>
<ul class="filter_choices">
<% labels.each do |nm,val| %>
<% label = "#{filter[:name]}_#{nm}".gsub(/\s+/,'_') %>
<li class="nowrap">
<input type="checkbox"
id="<%= label %>"
name="search[<%= filter[:scope].to_s %>][]"
value="<%= val %>"
<%= params[:search] && params[:search][filter[:scope]] && params[:search][filter[:scope]].include?(val.to_s) ? "checked" : "" %> />
<label class="nowrap" for="<%= label %>"> <%= nm %> </label>
</li>
<% end %>
</ul>
</div>
<% end %>
<%= submit_tag Spree.t(:search), :name => nil %>
<% end %>
<% end %>
任何想法为什么?