mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Merge branch 'master' into pin-refunds
This commit is contained in:
@@ -198,6 +198,18 @@ Spree::Order.class_eval do
|
||||
end
|
||||
end
|
||||
|
||||
# Does this order have shipments that can be shipped?
|
||||
def ready_to_ship?
|
||||
self.shipments.any?{|s| s.can_ship?}
|
||||
end
|
||||
|
||||
# Ship all pending orders
|
||||
def ship
|
||||
self.shipments.each do |s|
|
||||
s.ship if s.can_ship?
|
||||
end
|
||||
end
|
||||
|
||||
def available_shipping_methods(display_on = nil)
|
||||
Spree::ShippingMethod.all_available(self, display_on)
|
||||
end
|
||||
|
||||
@@ -74,6 +74,12 @@ Spree::Variant.class_eval do
|
||||
self.option_values.destroy ovs
|
||||
end
|
||||
|
||||
# Used like "product.name - full_name". If called like this, a product with
|
||||
# name "Bread" would be displayed as one of these:
|
||||
# Bread - 1kg # if display_name blank
|
||||
# Bread - Spelt Sourdough, 1kg # if display_name is "Spelt Sourdough, 1kg"
|
||||
# Bread - 1kg Spelt Sourdough # if unit_to_display is "1kg Spelt Sourdough"
|
||||
# Bread - Spelt Sourdough (1kg) # if display_name is "Spelt Sourdough" and unit_to_display is "1kg"
|
||||
def full_name
|
||||
return unit_to_display if display_name.blank?
|
||||
return display_name if display_name.downcase.include? unit_to_display.downcase
|
||||
|
||||
Reference in New Issue
Block a user