public
Description: Spree is a complete open source e-commerce solution for Ruby on Rails.
Home | Edit | New

A shortcut to provide searching functionality.

I was nonplussed that there was no default search functionality in the Spree system as shipped. It exists in the Admin section, but not in the default views.

Creating URLS such as

http://www.yourstore.com/store/products?search[conditions][name_contains]=Foo&search[conditions][or_description_contains]=Bar&search[conditions][any]=true

Getting this url will return all products with a name containing Foo or a description containing Bar. If you want them to be “AND” searches, just remove the search[conditions][any]=true or set it to false.

There are many more options to be used here for conditions, so check out searchlogic docs.

It would probably behoove one of us to create a search form that can be rendered on the main site.

[Note: the format of search options has changed in version 2 of search logic]

Last edited by paulcc, Sat Aug 01 00:43:52 -0700 2009
Home | Edit | New
Versions: