Class: Spree::StoreController
Direct Known Subclasses
Account::BaseController, AddressesController, CheckoutController, ContactsController, DigitalLinksController, HomeController, LineItemsController, NewsletterSubscribersController, OrderStatusController, OrdersController, PageSectionsController, PagesController, PasswordController, PoliciesController, PostsController, ProductsController, SearchController, SeoController, SettingsController, TaxonomiesController, TaxonsController, WishlistsController
Instance Method Summary
collapse
#analytics_event_handlers, #track_event, #unsupported_event?, #visitor_id
#current_wishlist
#redirect_to_password
#as_aspect_ratio, #page_description, #page_image, #paths_equal?, #render_storefront_partials, #show_account_pane?, #svg_country_icon, #tailwind_classes_for
#default_url_options, #set_theme_view_paths
Instance Method Details
#current_taxon ⇒ Object
45
46
47
|
# File 'app/controllers/spree/store_controller.rb', line 45
def current_taxon
@current_taxon ||= (current_store.taxons.find_by(id: params[:taxon_id]) if params[:taxon_id].present?)
end
|
#default_products_sort ⇒ Object
85
86
87
|
# File 'app/controllers/spree/store_controller.rb', line 85
def default_products_sort
'manual'
end
|
#permitted_products_params ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'app/controllers/spree/store_controller.rb', line 61
def permitted_products_params
@permitted_products_params ||= params.permit(
:locale,
:currency,
:q,
:page,
:per_page,
:sort_by,
filter: [
:min_price,
:max_price,
:purchasable,
:out_of_stock,
{
options: [store_filter_names_hash],
taxon_ids: [],
taxonomy_ids: [
taxon_ids: []
]
}
]
)
end
|
#products_filters_params ⇒ Object
89
90
91
|
# File 'app/controllers/spree/store_controller.rb', line 89
def products_filters_params
@products_filters_params ||= permitted_products_params[:filter]&.compact_blank || {}
end
|
#render_404_if_store_not_exists ⇒ Object
39
40
41
42
43
|
# File 'app/controllers/spree/store_controller.rb', line 39
def render_404_if_store_not_exists
return if current_store.present?
render 'errors/404', layout: 'application', status: :not_found
end
|
#store_filter_names ⇒ Object
49
50
51
|
# File 'app/controllers/spree/store_controller.rb', line 49
def store_filter_names
@store_filter_names ||= Spree::OptionType.filterable.order(:position).pluck(:name)
end
|
#store_filter_names_hash ⇒ Object
53
54
55
56
57
58
59
|
# File 'app/controllers/spree/store_controller.rb', line 53
def store_filter_names_hash
filter_names = {}
store_filter_names.each do |filter_name|
filter_names[filter_name.to_sym] = []
end
filter_names
end
|