Module: SpreeProductSortInOrderOfIds::Spree::Products::SortDecorator
- Defined in:
- app/sorters/spree_product_sort_in_order_of_ids/spree/products/sort_decorator.rb
Instance Method Summary collapse
- #call ⇒ Object
- #initialize(scope, current_currency, params = {}, allowed_sort_attributes = []) ⇒ Object
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/sorters/spree_product_sort_in_order_of_ids/spree/products/sort_decorator.rb', line 8 def call if sort_by?('specified_ids_order') products = by_specified_ids_order(scope) else products = by_param_attributes(scope) products = by_price(products) products = by_sku(products) end products.distinct end |
#initialize(scope, current_currency, params = {}, allowed_sort_attributes = []) ⇒ Object
2 3 4 5 6 |
# File 'app/sorters/spree_product_sort_in_order_of_ids/spree/products/sort_decorator.rb', line 2 def initialize(scope, current_currency, params = {}, allowed_sort_attributes = []) super(scope, current_currency, params, allowed_sort_attributes) @currency = params[:currency] || current_currency @ids_order = params.dig('filter', 'ids') end |