Module: Workarea::Storefront::ProductBrowsing
Instance Method Summary
collapse
Methods included from Pagination
#first_page?, #last_page?, #next_page, #prev_page, #search_query, #second_page?, #total_pages
Instance Method Details
#facets ⇒ Object
28
29
30
|
# File 'app/view_models/workarea/storefront/product_browsing.rb', line 28
def facets
search_query.facets.reject(&:useless?)
end
|
#filters ⇒ Object
21
22
23
24
25
26
|
# File 'app/view_models/workarea/storefront/product_browsing.rb', line 21
def filters
search_query.facets.reduce({}) do |memo, facet|
memo[facet.system_name] = facet.selections if facet.selected?
memo
end
end
|
#has_filters? ⇒ Boolean
17
18
19
|
# File 'app/view_models/workarea/storefront/product_browsing.rb', line 17
def has_filters?
facets.any?(&:selected?)
end
|
#product_browse_cache_key ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'app/view_models/workarea/storefront/product_browsing.rb', line 7
def product_browse_cache_key
@product_browse_cache_key ||= options
.except(:user)
.to_a
.sort
.flatten
.reject(&:blank?)
.join('/')
end
|