Module: Spree::TaxonsHelper
- Defined in:
- app/helpers/spree/taxons_helper.rb
Instance Method Summary collapse
-
#taxon_products(taxon) ⇒ ActiveRecord::Relation<Spree::Product>
Products for the taxon.
Instance Method Details
#taxon_products(taxon) ⇒ ActiveRecord::Relation<Spree::Product>
Returns products for the taxon.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/spree/taxons_helper.rb', line 5 def taxon_products(taxon) @products_cache ||= {} @products_cache[taxon.id] ||= begin finder_params = { store: current_store, filter: { taxons: taxon.id }, currency: current_currency, sort_by: 'default' } scope = current_store.products.includes(storefront_products_includes).preload_associations_lazily storefront_products_finder.new(scope: scope, params: finder_params).execute end end |