diff --git a/app/models/environment_finder.rb b/app/models/environment_finder.rb index 9678789..f31a638 100644 --- a/app/models/environment_finder.rb +++ b/app/models/environment_finder.rb @@ -18,6 +18,8 @@ class EnvironmentFinder if query.blank? if product_category && asset == :products @environment.send(asset).find(:all, options.merge({:order => 'created_at desc, id desc', :conditions => ['product_category_id in (?)', product_category_ids]})) + elsif product_category && asset == :enterprises + @environment.send(asset).find_by_contents("extra_data_for_index:#{product_category.name}", {}, options.merge( {:order => 'created_at desc, id desc'} ) ) else @environment.send(asset).find( :all, options.merge( {:order => 'created_at desc, id desc'} ) ) end @@ -25,6 +27,8 @@ class EnvironmentFinder if product_category && asset == :products # SECURITY no risk of SQL injection, since product_category_ids comes from trusted source @environment.send(asset).find_by_contents(query, {}, options.merge({:conditions => 'product_category_id in (%s)' % product_category_ids.join(',') })) + elsif product_category && asset == :enterprises + @environment.send(asset).find_by_contents(query + " +extra_data_for_index:#{product_category.name}", {}, options) else @environment.send(asset).find_by_contents(query, {}, options) end diff --git a/app/views/search/products.rhtml b/app/views/search/products.rhtml index 3c2949b..3b913e6 100644 --- a/app/views/search/products.rhtml +++ b/app/views/search/products.rhtml @@ -13,7 +13,7 @@ <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> <% if @found_product_categories %> -