File tree Expand file tree Collapse file tree
components/solidus_admin/products/stock
controllers/solidus_admin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ class SolidusAdmin::Products::Stock::Component < SolidusAdmin::BaseComponent
44 def self . from_product ( product )
55 new (
66 on_hand : product . total_on_hand ,
7- variants_count : product . variants . count
7+ variants_count : product . variants . size
88 )
99 end
1010
Original file line number Diff line number Diff line change @@ -8,18 +8,23 @@ class ProductsController < SolidusAdmin::BaseController
88 search_scope ( :deleted ) { _1 . with_discarded . discarded }
99 search_scope ( :discontinued ) { _1 . where ( discontinue_on : ...Time . current ) }
1010 search_scope ( :available ) { _1 . available }
11- search_scope ( :in_stock ) { _1 . where ( id : Spree ::Variant . in_stock . distinct . select ( :product_id ) ) }
12- search_scope ( :out_of_stock ) { _1 . where . not ( id : Spree ::Variant . in_stock . distinct . select ( :product_id ) ) }
11+ search_scope ( :in_stock ) { _1 . where ( id : Spree ::Variant . in_stock . select ( :product_id ) ) }
12+ search_scope ( :out_of_stock ) { _1 . where . not ( id : Spree ::Variant . in_stock . select ( :product_id ) ) }
1313
1414 def index
1515 products = apply_search_to (
16- Spree ::Product . includes ( :master , :variants ) ,
17- param : :q
16+ Spree ::Product . includes (
17+ :variant_images ,
18+ master : :prices ,
19+ variants : :prices
20+ ) ,
21+ param : :q ,
22+ distinct : false
1823 )
1924
2025 set_page_and_extract_portion_from (
2126 products ,
22- ordered_by : { updated_at : :desc , id : :desc }
27+ ordered_by : { name : :asc }
2328 )
2429
2530 respond_to do |format |
You can’t perform that action at this time.
0 commit comments