Class: Spree::ProductsController

Inherits:
StoreController show all
Defined in:
app/controllers/spree/products_controller.rb

Instance Method Summary collapse

Methods inherited from StoreController

#unauthorized

Instance Method Details

#indexObject



9
10
11
12
# File 'app/controllers/spree/products_controller.rb', line 9

def index
  @searcher = build_searcher(params)
  @products = @searcher.retrieve_products
end

#showObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/spree/products_controller.rb', line 14

def show
  return unless @product

  @variants = @product.variants_including_master.active(current_currency).includes([:option_values, :images])
  @product_properties = @product.product_properties.includes(:property)

  referer = request.env['HTTP_REFERER']
  if referer
    begin
      referer_path = URI.parse(request.env['HTTP_REFERER']).path
      # Fix for #2249
    rescue URI::InvalidURIError
      # Do nothing
    else
      if referer_path && referer_path.match(/\/t\/(.*)/)
        @taxon = Taxon.find_by_permalink($1)
      end
    end
  end
end