Permalink
Browse files

Fixes pagination.

  • Loading branch information...
1 parent 6a3c148 commit 72713ac62cc61ac0351add21e5dd004632d7d059 @JDutil JDutil committed Mar 13, 2013
Showing with 7 additions and 4 deletions.
  1. +1 −1 app/views/spree/shared/_filters.html.erb
  2. +6 −3 lib/spree/sunspot/search.rb
@@ -8,7 +8,7 @@
<%= render :partial => "spree/filters/#{filter.search_param}", :locals => { :filter => filter }%>
<% else %>
<div class="filter" data-field="<%= filter.search_param %>">
- <h6 class="filter-title"> <%= filter.display_name %> </h6>
+ <h6 class="filter-title"><%= t :shop_by_taxonomy, :taxonomy => filter.display_name %></h6>
<ul class="filter_choices">
<% filter.html_values.each_with_index do |hv, index| %>
<li class="nowrap">
@@ -27,8 +27,8 @@ def retrieve_products(*args)
end
end
- curr_page = page || 1
-
+ curr_page = @properties[:page] || 1
+ per_page = @properties[:per_page] || Spree::Config[:products_per_page]
@products = @products_scope.includes([:master]).page(curr_page).per(per_page)
end
@@ -73,7 +73,10 @@ def get_products_conditions_for(base_scope, query)
q.order_by(
ordering_property.flatten.first,
ordering_property.flatten.last)
- q.paginate(page: @properties[:page] || 1, per_page: @properties[:per_page] || Spree::Config[:products_per_page])
+ # Use a high per_page here so that all results are retrieved when setting base_scope at the end of this method.
+ # Otherwise you'll never have more than the first page of results from here returned, when pagination is done
+ # during the retrieve_products method.
+ q.paginate(page: 1, per_page: Spree::Product.count)
end
unless @properties[:filters].blank?

0 comments on commit 72713ac

Please sign in to comment.