Merge branch 'master' into pin-refunds

This commit is contained in:
Rohan Mitchell
2015-05-01 14:58:19 +10:00
13 changed files with 224 additions and 5 deletions

View File

@@ -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

View File

@@ -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