mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-03 22:06:07 +00:00
Sort orders by last name, then first name i.e. the same way bulk order management works
This commit is contained in:
@@ -16,7 +16,8 @@ module Spree
|
||||
searchable_attributes :number, :state, :shipment_state, :payment_state, :distributor_id,
|
||||
:order_cycle_id, :email, :total, :customer_id
|
||||
searchable_associations :shipping_method, :bill_address, :distributor
|
||||
searchable_scopes :complete, :incomplete
|
||||
searchable_scopes :complete, :incomplete, :sort_by_billing_address_name_asc,
|
||||
:sort_by_billing_address_name_desc
|
||||
|
||||
checkout_flow do
|
||||
go_to_state :address
|
||||
@@ -145,6 +146,14 @@ module Spree
|
||||
end
|
||||
}
|
||||
|
||||
scope :sort_by_billing_address_name_asc, -> {
|
||||
joins(:bill_address).order("spree_addresses.lastname ASC, spree_addresses.firstname ASC")
|
||||
}
|
||||
|
||||
scope :sort_by_billing_address_name_desc, -> {
|
||||
joins(:bill_address).order("spree_addresses.lastname DESC, spree_addresses.firstname DESC")
|
||||
}
|
||||
|
||||
scope :with_line_items_variants_and_products_outer, lambda {
|
||||
left_outer_joins(line_items: { variant: :product })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user