Has anyone ever run into 'undefined method `brand_filter' for ProductFilters:Module'?

32 views
Skip to first unread message

Josh McArthur

unread,
Dec 2, 2010, 8:03:19 PM12/2/10
to Spree
This one's confusing me - it works locally, of course, but on the
testing server I can't get to any product pages from the main product
listing, unless I open the link in a new tab.

Any ideas?

Adam Jahn

unread,
Dec 2, 2010, 9:01:32 PM12/2/10
to spree...@googlegroups.com
As far I know, this filter is only defined if a property with the name "brand" exists in the database. Should work for the sample set of data, since it includes some products with a brand property. The Taxon model specifies the brand_filter in the applicable_filters method by default. If you are using filters, but don't want filtering on a brand property, then you should override that method.

in app/models/taxon_decorator.rb, add

Taxon.class_eval do
def applicable_filters
fs = []
fs << ProductFilters.taxons_below(self)
## unless it's a root taxon? left open for demo purposes
fs += [
ProductFilters.price_filter,
# Add whatever other filtering you need here.
#ProductFilters.brand_filter, <-- comment this line out
#ProductFilters.selective_brand_filter(self)
]
end
end

That should get you past the brand_filter error, but from what I found today, it seems like a lot of other filtering stuff is broken.

If you or anyone has Product filtering running in 0.30.x, would you mind sharing what you did?

> --
> You received this message because you are subscribed to the Google Groups "Spree" group.
> To post to this group, send email to spree...@googlegroups.com.
> To unsubscribe from this group, send email to spree-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
>

Sean Schofield

unread,
Dec 2, 2010, 9:53:36 PM12/2/10
to spree...@googlegroups.com
> If you or anyone has Product filtering running in 0.30.x, would you mind sharing what you did?

Adam, I saw your earlier message on this as well. Its possible this
is not working in 0.30.x and was overlooked. We'll see if somebody
can take a look at that ASAP.

Sean Schofield

unread,
Dec 3, 2010, 7:10:56 AM12/3/10
to spree...@googlegroups.com
Roman is going to look at it. Stand by for a fix in the next day or so.

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

Adam Jahn

unread,
Dec 3, 2010, 9:37:12 AM12/3/10
to spree...@googlegroups.com
Thanks a lot guys!

Roman Smirnov

unread,
Dec 6, 2010, 3:38:43 PM12/6/10
to Spree
Basic functionality of ProductFilters was restored, but you should
keep in mind that it has a demonstration nature. For real use I
recommend spree_solr_search extension.

On 3 дек, 17:37, Adam Jahn <ajj...@me.com> wrote:
> Thanks a lot guys!
>
> On Dec 3, 2010, at 7:10 AM, Sean Schofield wrote:
>
> > Roman is going to look at it.  Stand by for a fix in the next day or so.
>
> > Sean Schofield
>
> > -------------------------------------------
> > Rails Dog LLC
> > 2 Wisconsin Circle, Suite 700
> >Chevy Chase, MD20815
> > voice: (301)560-2000
> > -------------------------------------------
>
> > On Thu, Dec 2, 2010 at 9:53 PM, Sean Schofield <s...@railsdog.com> wrote:
> >>> If you or anyone has Product filtering running in 0.30.x, would you mind sharing what you did?
>
> >> Adam, I saw your earlier message on this as well.  Its possible this
> >> is not working in 0.30.x and was overlooked.  We'll see if somebody
> >> can take a look at that ASAP.
>
> > --
> > You received this message because you are subscribed to theGoogle Groups"Spree" group.

Paul Callaghan

unread,
Dec 7, 2010, 5:53:35 AM12/7/10
to spree...@googlegroups.com
On Mon, Dec 6, 2010 at 8:38 PM, Roman Smirnov <pom...@gmail.com> wrote:
> Basic functionality of ProductFilters was restored, but you should
> keep in mind that it has a demonstration nature. For real use I
> recommend spree_solr_search extension.
>

Yes, it was a first attempt at doing faceted search. Solr is much
better for serious use, though the filter stuff is ok for simple use
if you don't want to jump into Solr just yet (and the filter stuff can
do a few extra tricks with sets of constraints, eg selecting >1
options in each facet).

I'd be interested to hear if anyone has made use of the filter code!

Paul

Tomek "Tomash" Stachewicz

unread,
Dec 12, 2010, 6:06:27 AM12/12/10
to Spree
Just upgraded one store to edge Spree (launched migrations etc.) and I
have this error as well when trying to browse any Taxon.

And I don't have "brand" property anywhere in my store.

Tomek "Tomash" Stachewicz

unread,
Dec 12, 2010, 6:18:57 AM12/12/10
to Spree
OK, people, this is insane:
in order to do a working upgrade, a Spree user/developer has to:
- override ProductFilter module
- create TaxonDecorator and override applicable_filters method
plus, of course, write custom loading logic in lib/spree_site.rb

None of these steps were required previously.

This is NUTS.

T.

On Dec 12, 12:06 pm, "Tomek \"Tomash\" Stachewicz"

Tomek "Tomash" Stachewicz

unread,
Dec 12, 2010, 6:25:42 AM12/12/10
to Spree
OK, added a ticket:
http://railsdog.lighthouseapp.com/projects/31096-spree/tickets/1797-do-not-make-product-filters-obligatory-in-clean-site

Give me 10 minutes for cloning, patching and sending a pull
request :)

On Dec 12, 12:18 pm, "Tomek \"Tomash\" Stachewicz"

Sean Schofield

unread,
Dec 12, 2010, 10:16:06 AM12/12/10
to spree...@googlegroups.com
> None of these steps were required previously.
>
> This is NUTS.

That's why its called "edge" code :-)

We're not looking to drive developers crazy - sometimes we break
things (especially on edge) when trying to improve functionality
elsewhere. I replied on your ticket with a request for more
information.

Sean

Tomek "Tomash" Stachewicz

unread,
Dec 12, 2010, 11:05:43 AM12/12/10
to Spree
I'm not mad, I know I'm asking for it by using edge :)

But I think you agree that finding "this should be implemented in your
store" in a file within spree core codebase is kind of surprising (and
made me WTF).

Anyway, thanks for the fix!
Tomash
Reply all
Reply to author
Forward
0 new messages