Skip to content

Commit

Permalink
Merge pull request #2408 from cbrunsdon/deprecate_taxons_below
Browse files Browse the repository at this point in the history
Deprecate weird taxon product filters
  • Loading branch information
jhawthorn committed Dec 20, 2017
2 parents 3d40f63 + fff13ea commit d07e5bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 0 additions & 3 deletions core/app/models/spree/taxon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ class Taxon < Spree::Base
# @return [Array] filters that should be used for a taxon
def applicable_filters
fs = []
# fs << ProductFilters.taxons_below(self)
## unless it's a root taxon? left open for demo purposes

fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)
fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)
fs
Expand Down
2 changes: 2 additions & 0 deletions core/lib/spree/core/product_filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def self.selective_brand_filter(taxon = nil)
# This scope selects products in any of the active taxons or their children.
#
def self.taxons_below(taxon)
Spree::Deprecation.warn "taxons_below is deprecated in solidus_core. Please add it to your own application to continue using it."
return Spree::Core::ProductFilters.all_taxons if taxon.nil?
{
name: 'Taxons under ' + taxon.name,
Expand All @@ -180,6 +181,7 @@ def self.taxons_below(taxon)
#
# idea: expand the format to allow nesting of labels?
def self.all_taxons
Spree::Deprecation.warn "all_taxons is deprecated in solidus_core. Please add it to your own application to continue using it."
taxons = Spree::Taxonomy.all.map { |t| [t.root] + t.root.descendants }.flatten
{
name: 'All taxons',
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/views/spree/shared/_filters.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% filters = @taxon ? @taxon.applicable_filters : [Spree::Core::ProductFilters.all_taxons] %>
<% filters = @taxon.applicable_filters %>
<% unless filters.empty? %>
<%= form_tag '', method: :get, id: 'sidebar_products_search' do %>
<%= hidden_field_tag 'per_page', params[:per_page] %>
Expand Down

0 comments on commit d07e5bd

Please sign in to comment.