Sha256: 81134b85184a89cdd62447072187b24e4f71778094f8f37ad07c70f02605f0cf

Contents?: true

Size: 760 Bytes

Versions: 4

Compression:

Stored size: 760 Bytes

Contents

module Spree
  class TaxonsController < Spree::StoreController
    rescue_from ActiveRecord::RecordNotFound, with: :render_404
    helper 'spree/products'

    respond_to :html

    def show
      @taxon = Spree::Taxon.find_by!(permalink: params[:id])
      return unless @taxon

      @searcher = build_searcher(params.merge(taxon: @taxon.id, include_images: true).reject { |k, _| ["per_page", "page"].include?(k) } )
      @products = @searcher.retrieve_products.page(params[:page] || 1).per(params[:per_page].presence || Spree::Config[:products_per_page])
      @taxonomies = Spree::Taxonomy.includes(root: :children)
    end

    private

    def accurate_title
      if @taxon
        @taxon.seo_title
      else
        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_frontend-2.4.1 app/controllers/spree/taxons_controller.rb
solidus_frontend-2.4.0 app/controllers/spree/taxons_controller.rb
solidus_frontend-2.4.0.rc1 app/controllers/spree/taxons_controller.rb
solidus_frontend-2.4.0.beta1 app/controllers/spree/taxons_controller.rb