Sha256: 0c135b5ecd6351f71c8bea1179de430692a85c4a0a9ee4cf54c1f6eabaf25ea4
Contents?: true
Size: 1.47 KB
Versions: 4
Compression:
Stored size: 1.47 KB
Contents
module Spree class ProductsController < Spree::StoreController before_action :load_product, only: :show before_action :load_taxon, only: :index rescue_from ActiveRecord::RecordNotFound, with: :render_404 helper 'spree/taxons' respond_to :html def index @searcher = build_searcher(params.merge(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 def show @variants = @product. variants_including_master. display_includes. with_prices(current_pricing_options). includes([:option_values, :images]) @product_properties = @product.product_properties.includes(:property) @taxon = Spree::Taxon.find(params[:taxon_id]) if params[:taxon_id] end private def accurate_title if @product @product.meta_title.blank? ? @product.name : @product.meta_title else super end end def load_product if try_spree_current_user.try(:has_spree_role?, "admin") @products = Spree::Product.with_deleted else @products = Spree::Product.available end @product = @products.friendly.find(params[:id]) end def load_taxon @taxon = Spree::Taxon.find(params[:taxon]) if params[:taxon].present? end end end
Version data entries
4 entries across 4 versions & 1 rubygems