Skip to content

Instantly share code, notes, and snippets.

@bryanmtl
Created September 17, 2013 01:06
Show Gist options
  • Save bryanmtl/6588851 to your computer and use it in GitHub Desktop.
Save bryanmtl/6588851 to your computer and use it in GitHub Desktop.
Spree::Shipment.class_eval do
def send_shipped_email
unless Rails.env.production?
::Spree::ShipmentMailer.shipped_email(self.id).deliver
end
end
end
Spree::Order.class_eval do
def deliver_order_confirmation_email
unless Rails.env.production?
begin
::Spree::OrderMailer.confirm_email(self.id).deliver
rescue Exception => e
logger.error("#{e.class.name}: #{e.message}")
logger.error(e.backtrace * "\n")
end
end
end
def after_cancel
restock_items!
unless Rails.env.production?
::Spree::OrderMailer.cancel_email(self.id).deliver
unless %w(partial shipped).include?(shipment_state)
self.payment_state = 'credit_owed'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment