Sha256: 50e06e1d4f5ee5698e6ec840ed49d5431f3329a79bdfb3c59c4d8eeebf9e2c7d

Contents?: true

Size: 778 Bytes

Versions: 1

Compression:

Stored size: 778 Bytes

Contents

Spree::ProductsController.class_eval do

  def advanced_search
      @searcher = build_searcher(params)

      @products = @searcher.retrieve_products.includes(:add_on_makers).includes(:variants_including_master => :prices).includes(:taxons)
      @q = @products.search(params[:q])

    if params[:q]
      is_blank = (params[:q][:s].blank? && params[:q][:name_cont].blank? && params[:q][:add_on_makers_id_eq].blank? && params[:q][:variants_including_master_sku_cont].blank? && params[:q][:variants_including_master_prices_amount_gteq].blank? && params[:q][:variants_including_master_prices_amount_lteq].blank?) ? true : false
      unless is_blank
      @products = @q.result.page.per(Spree::Config[:products_per_page])
      end
    end
    render "advanced_search"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_maker_advanced_search-0.1.0 app/controllers/products_controller_decorator.rb