Class: Spree::ProductsController

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

Instance Method Summary collapse

Methods inherited from StoreController

#cart_link, #forbidden, #unauthorized

Instance Method Details

#indexObject



11
12
13
14
15
16
# File 'app/controllers/spree/products_controller.rb', line 11

def index
  @searcher = build_searcher(params.merge(include_images: true))
  @products = @searcher.retrieve_products
  @products = @products.includes(:possible_promotions) if @products.respond_to?(:includes)
  @taxonomies = Spree::Taxonomy.includes(root: :children)
end

#showObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/spree/products_controller.rb', line 18

def show
  @variants = @product.variants_including_master.
                       spree_base_scopes.
                       active(current_currency).
                       includes([:option_values, :images])
  @product_properties = @product.product_properties.includes(:property)
  @taxon = params[:taxon_id].present? ? Spree::Taxon.find(params[:taxon_id]) : @product.taxons.first
  redirect_if_legacy_path
end