Class: Spree::ProductsController
Instance Method Summary
collapse
#http_cache_enabled?
#additional_filters_partials, #asset_exists?, #available_option_types, #available_option_types_cache_key, #available_properties, #available_properties_cache_key, #body_class, #carousel_image_source_set, #checkout_available_payment_methods, #checkout_progress, #class_for, #color_option_type_name, #country_flag_icon, #filtering_params, #filtering_params_cache_key, #filters_cache_key, #flash_messages, #icon, #image_source_set, #lazy_image, #link_to_cart, #logo, #option_type_cache_key, #permitted_product_params, #permitted_products_params, #plp_and_carousel_image, #price_filter_values, #product_description, #product_wysiwyg_editor_enabled?, #set_image_alt, #spree_breadcrumbs, #spree_social_link, #static_filters, #taxon_wysiwyg_editor_enabled?, #taxons_tree
#account_link, #api_tokens, #cart_link, #ensure_cart
Instance Method Details
#index ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'app/controllers/spree/products_controller.rb', line 12
def index
@searcher = build_searcher(params.merge(include_images: true, current_store: current_store))
@products = @searcher.retrieve_products
if http_cache_enabled?
fresh_when etag: etag_index, last_modified: last_modified_index, public: true
end
end
|
36
37
38
39
40
41
42
|
# File 'app/controllers/spree/products_controller.rb', line 36
def related
if product_relation_types.any?
render template: 'spree/products/related', layout: false
else
head :no_content
end
end
|
#show ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/spree/products_controller.rb', line 21
def show
redirect_if_legacy_path
@taxon = params[:taxon_id].present? ? taxons_scope.find_by(id: params[:taxon_id]) : nil
@taxon = @product.taxons.first unless @taxon.present?
if !http_cache_enabled? || stale?(etag: etag_show, last_modified: last_modified_show, public: true)
@product_summary = Spree::ProductSummaryPresenter.new(@product).call
@product_properties = @product.product_properties.includes(:property)
@product_price = @product.price_in(current_currency).amount
load_variants
@product_images = product_images(@product, @variants)
end
end
|